JSPM

same-origin

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 77349
  • Score
    100M100P100Q192783F
  • License MIT

Checks if two URLs pass the "same origin"-policy (RFC 6454)

Package Exports

  • same-origin
  • same-origin/url-parser.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (same-origin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

same-origin

Checks if two URLs pass the "same origin"-policy (RFC 6454)

Build Status

browser support

Installation

Run npm install --save same-origin to include it in your project.

Works well with browserify.

Usage

var sameOrigin = require('same-origin');
var url1 = 'http://example.com/some/page.html';
var url2 = 'http://example.com/some/other/page.html';
var url3 = 'http://espen.codes/nodejs';
sameOrigin(url1, url2); // true
sameOrigin(url1, url3); // false

same-origin works in most environments:

// CommonJS
var sameOrigin = require('same-origin');

// AMD (Require.JS, yepnope, dojo...)
define(['same-origin'], function(sameOrigin) {
    // ...
});

// Browser global (if CommonJS/AMD environment not found)
window.sameOrigin(url1, url2);

License

MIT-licensed. See LICENSE.