visionmedia / page.js

Micro client-side router inspired by the Express router

Home Page:http://visionmedia.github.com/page.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IE11 support

akoevroman opened this issue · comments

commented

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?

commented

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.

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!