is-same-origin

0.0.7 • Public • Published

is-same-origin

npm version

Check if two URLs are same origin, for Node and the browser

Installation

npm install is-same-origin
// Using ES6 modules
import isSameOrigin from 'is-same-origin';
 
// Using CommonJS modules
const isSameOrigin = require('is-same-origin');

The CDN build is also available on unpkg:

Usage

const isSameOrigin = require('is-same-origin');
 
isSameOrigin('http://www.example.com/dir/page.html',
  'http://www.example.com/dir/page2.html');
// => true
 
isSameOrigin('http://www.example.com/dir/page.html',
  'http://en.example.com/dir/other.html');
// => false

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i is-same-origin

Weekly Downloads

3

Version

0.0.7

License

MIT

Unpacked Size

33.8 kB

Total Files

11

Last publish

Collaborators

  • dearke