Skip to content

Instantly share code, notes, and snippets.

@brenopolanski
Forked from ubershmekel/origin.js
Created November 2, 2015 18:17
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 brenopolanski/7ddc9a986f548ae8e001 to your computer and use it in GitHub Desktop.
Save brenopolanski/7ddc9a986f548ae8e001 to your computer and use it in GitHub Desktop.
var origin = function () {
// IE10 Doesn't have window.location.origin :(
if (!window.location.origin) {
var port = window.location.port ? ':' + window.location.port : '';
return window.location.protocol + "//" + window.location.hostname + port;
} else {
return window.location.origin;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment