visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

IE11 support #543

Open akoevroman opened 4 years ago

akoevroman commented 4 years ago

I am running base example in IE11 and it always makes a page refresh.

Can anyone provide a working example based on examples/basic? page.base('/basic'); What I should write in history.redirect for preventing page refresh in IE11?

akoevroman commented 4 years ago

Digging deeper I found that this lib should work in ie11. But seems that there is an error in Page.prototype.sameOrigin loc.port is empty in browsers but url.port returns 433 in IE11 for secure urls.

This is due to the difference in this function: Page.prototype._toURL All browsers have function URL, but IE11 does not.

So if we remove this one loc.port === url.port IE11 will work. I know that this check is for (http and https) but seems it is not working in browsers, at least in such an implementation.

ghost commented 4 years ago

There will be a fix for IE in the next release BUT that doesn't support secure websites (https).

You also have to check port 443 in Page.prototype.sameOrigin:

return loc.protocol === url.protocol && loc.hostname === url.hostname && (loc.port === url.port || (loc.port === '' && (url.port === '80' || url.port === '443')));

Works fine for me!