Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/location-origin.js
Polyfill for window.location.origin
https://github.com/shinnn/location-origin.js
Last synced: 26 days ago
JSON representation
Polyfill for window.location.origin
- Host: GitHub
- URL: https://github.com/shinnn/location-origin.js
- Owner: shinnn
- License: mit
- Created: 2014-03-30T13:53:51.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-18T14:33:00.000Z (over 9 years ago)
- Last Synced: 2024-10-11T22:28:13.048Z (about 1 month ago)
- Language: JavaScript
- Size: 469 KB
- Stars: 13
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# location-origin.js
[![Bower version](https://img.shields.io/bower/v/location-origin.svg)](https://github.com/shinnn/location-origin.js/releases)
[![NPM version](https://img.shields.io/npm/v/location-origin.svg)](https://www.npmjs.com/package/location-origin)
[![Build Status](https://img.shields.io/travis/shinnn/location-origin.js.svg)](https://travis-ci.org/shinnn/location-origin.js)
[![devDependency Status](https://david-dm.org/shinnn/location-origin.js/dev-status.svg)](https://david-dm.org/shinnn/location-origin.js#info=devDependencies)[![browser support](https://ci.testling.com/shinnn/location-origin.js.png)](https://ci.testling.com/shinnn/location-origin.js)
Polyfill for [`window.location.origin`](https://url.spec.whatwg.org/#dom-urlutilsreadonly-origin)
```javascript
// On http://localhost:8888/path/to/page.html#hash?search=foobarwindow.location.origin; //=> "http://localhost:8888"
```## Installation
### Package managers
#### [Bower](http://bower.io/)
```sh
bower install location-origin
```#### [npm](https://www.npmjs.com/)
```sh
npm install location-origin
```#### [Duo](http://duojs.org/)
```javascript
// 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");
```### Standalone
[Download the script file directly.](https://raw.githubusercontent.com/shinnn/location-origin.js/master/dist/location-origin.js "view raw")
## Acknowledgements
I used [the blog post by Toby Osbourn](http://tosbourn.com/2013/08/javascript/a-fix-for-window-location-origin-in-internet-explorer/ "A fix for window.location.origin in Internet Explorer") as reference.
Thanks, [tosbourn](https://github.com/tosbourn).## License
[src/location-origin.coffee](./src/location-origin.coffee) and [dist/location-origin.js](./dist/location-origin.js) are licensed under [the Unlicense](./LICENSE-UNLICENSE).
All other source code is licensed under [the MIT license](./LICENSE-MIT).