Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link & router using "window.location.origin": IE11 incompatible #1120

Closed
eezing opened this issue Feb 14, 2017 · 2 comments
Closed

link & router using "window.location.origin": IE11 incompatible #1120

eezing opened this issue Feb 14, 2017 · 2 comments

Comments

@eezing
Copy link

eezing commented Feb 14, 2017

References to window.location.origin found in two places. window.location.origin doesn't exists in IE11.

This in link:

export function isLocal (href) {
  const origin = window.location.origin
  return !/^(https?:)?\/\//.test(href) ||
    origin === href.substr(0, origin.length)
}

This in router:

function getURL () {
  const { href, origin } = window.location
  return href.substring(origin.length)
}

IE11 compatible replacement:

const origin = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port: '')

We can either polyfill window.location.origin (not a huge fan of polyfills) or replace the line in both chunks.

@eezing eezing changed the title <Link> using "window.location.origin": IE11 incompatible (and others) link & router using "window.location.origin": IE11 incompatible Feb 14, 2017
@arunoda
Copy link
Contributor

arunoda commented Feb 14, 2017

Okay. That's good.
Send a PR.

Add a common function inside the lib/utils to do this.

@eezing
Copy link
Author

eezing commented Feb 14, 2017

@arunoda will do

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

No branches or pull requests

2 participants