Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Cross-compatible and easy frame cross-domain communication through Web Messaging API

License

GPL-2.0, Unknown licenses found

Licenses found

GPL-2.0
LICENSE-GPL
Unknown
LICENSE-MIT
Notifications You must be signed in to change notification settings

leodutra/simple-postmessage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-postMessage:
The cross-domain messaging helper

Use simple-postMessage if you want to securely communicate IFrame content script with it's parent document/window, even on cross-domain interactions.

simple-postMessage enables simple and easy window.postMessage() communication in browsers that support the HTML5 API (FF3+, Safari 4+, IE8+), while falling back to a document.location.hash communication method for all other browsers (IE6 and IE7 mainly).

simple-postMessage uses JSON.parse/stringify() to post/receive JavaScript objects as message on IE9 and IE8 (although IE8 compat. mode has no JSON and you'll need Crockford's json2.js to optionally support it).

simple-postMessage uses encodeURIComponent/decodeURIComponent() to send safe messages on older browsers (and fixes Mozilla's "+" problem).

IE8 (and lower) doesn’t allow to postMessage to other windows, only to iframes.

Crockford's json2.js or json.js allows IE7 and IE6 to send object as message and is required if you want total compatibility between modern browsers + IE7/IE6.

Using it

Just import simple-postMessage.js (json2.js is an optional to support object serialization on IE8 compat., IE7 and IE6), and use simplePostMessage(message, target_url, target) to send messages and simpleReceiveMessage(callback, source_origin) to receive them.

Releases

Visit the releases section

History

Based on Ben Alman's jQuery-postMessage and the clean Thomas Sturm's ender-postMessage

License

Dual licensed under the MIT and GPL licenses.

original jQuery-postMessage code: Copyright (c) 2009 "Cowboy" Ben Alman
Dual licensed under the MIT and GPL licenses.
http://benalman.com/about/license/

About

Cross-compatible and easy frame cross-domain communication through Web Messaging API

Resources

License

GPL-2.0, Unknown licenses found

Licenses found

GPL-2.0
LICENSE-GPL
Unknown
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%