Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cross-domain-events

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-domain-events

Event-like api for postMessage to send objects between cross-domain frames

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

cross-domain-events

An event-like interface to postMessage for cross domain communication.

Build Status

Sauce Test Status

postMessage was implemented in Internet Explorer 8, but only supports sending text strings. Modern browsers can send objects, but if you want to listen for different kind of objects you have to implement your own delegation.

Example

// notify parent about page size
xde.sendTo(window.top, "resize", {
	width: iframe.clientWidth,
	height: iframe.clientHeight
});

// parent page
xde.on("resize", function (evt) {
	var iframe = document.getElementById("theiframe");
	iframe.style.width = evt.data.width;
	iframe.style.height = evt.data.height;
});

Works in IE8 & IE9 as long as you have ES5-shim (for Array.prototype.filter) and JSON.js already.

License

MIT

Keywords

FAQs

Package last updated on 21 Apr 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc