Polyfill for window.location.origin
// On http://localhost:8888/path/to/page.html#hash?search=foobar
window.location.origin; //=> "http://localhost:8888"
bower install location-origin
npm install location-origin
// You don't have to assign it to a variable.
// It automatically adds `origin` property to the window.location object when it is `require`d.
require("shinnn/location-origin.js");
Download the script file directly.
I used the blog post by Toby Osbourn as reference. Thanks, tosbourn.
src/location-origin.coffee and dist/location-origin.js are licensed under the Unlicense.
All other source code is licensed under the MIT license.