Socket
Socket
Sign inDemoInstall

same-origin

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    same-origin

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


Version published
Weekly downloads
53K
decreased by-14.58%
Maintainers
1
Install size
12.9 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 23 Jul 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc