Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Router crashes if port number changes #33

Open
Avocher opened this issue Jul 2, 2018 · 3 comments
Open

Router crashes if port number changes #33

Avocher opened this issue Jul 2, 2018 · 3 comments

Comments

@Avocher
Copy link

Avocher commented Jul 2, 2018

We have a dev server for handling local signin that is on separate port. This seems to crash the router with the following message:

Uncaught DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'https://localhost:9080/xxxxx' cannot be created in a document with origin 'https://localhost'

Thanks for you this great library!

@frankiefu
Copy link
Member

@Avocher Do you have a simple test that we can run to reproduce the issue?

@keanulee
Copy link
Contributor

Could be on IE where window.location.origin doesn't exist and we build our own:

    const location = window.location;
    const origin = location.origin || location.protocol + '//' + location.host;
    if (href.indexOf(origin) !== 0) return;

To fix, we need to account for port number, but bear in mind most hrefs don't contain the default port number. For full IE support the implementation would look more like iron-location.

(Or, better yet, don't use IE)

@jsilvermist
Copy link

(Or, better yet, don't use IE)

I'll just leave this here... 😇

# Redirect Internet Explorer users to Chrome download page
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_USER_AGENT} (MSIE|IE11|Trident\/7\.) [NC]
  RewriteRule ^(.*)$ https://www.google.com/chrome/ [NC,L,R]
</IfModule>

PS: Not saying this is necessarily a good idea haha

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants