Skip to content

Instantly share code, notes, and snippets.

@haydenbleasel
Last active July 20, 2017 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haydenbleasel/332e10a733ef74e1fedce6099a31a805 to your computer and use it in GitHub Desktop.
Save haydenbleasel/332e10a733ef74e1fedce6099a31a805 to your computer and use it in GitHub Desktop.
Window location origin polyfill (ES6)
if (!window.location.origin) {
const { protocol, hostname, port } = window.location;
window.location.origin = `${protocol}//${hostname}${port ? `:${port}` : ''}`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment