get-location-origin

Get the window.location.origin string - even if not supported by the browser

Usage no npm install needed!

<script type="module">
  import getLocationOrigin from 'https://cdn.skypack.dev/get-location-origin';
</script>

README

get-location-origin

Get the window.location.origin string - even if not supported by the browser

  • This is not a polyfill
  • Does not modify the window.location object

Install

npm install --save get-location-origin

Usage

var origin = require('get-location-origin');

console.log(origin);
// => "http://localhost:3000"