seamless-polyfill v0.1.3
#Seamless Polyfill
A Javascript polyfill for the HTML5 iframe's seamless attribute.
This is an experimental polyfill for the iframe seamless attribute
which does not currently have much support amongst stable browsers. In order to
give us a similar effect, this polyfill will use the window.postMessage method
to send information about the iframe's scrollHeight so it can be used by the
parent to adjust the height of the iframe.
Usage
Seamless is compatible with AMD and CommonJS module loaders. You can also just
include seamless.js manually to create a global seamless object.
You can install this package using bower or npm.
bower install seamless-polyfillor
npm install seamless-polyfillOn any page that will be loaded in a frame, call seamless.frame.
seamless.frame({
'allowed_domains': ['http://localhost:5000'],
'target_origin': '*'
});On any page that contains frames, call seamless.parent.
seamless.parent({
'allowed_domains': ['http://localhost:5000'],
'target_origin': '*'
});Any iframes on the parent page with the seamless attribute set will be effected.
seamless is a boolean attribute so it does not require a value. Simply set it as:
<iframe src="..." frameborder="0" seamless>Arguments
- allowed_domains: Domain whitelist used for
window.postMessage. If the domains of the frame and parent are not included, one or both will not respond to messages. - target_origin: targetOrigin value used for window.postMessage. Defaults to
*.