gardr-plugin-ext-postscribe
v0.2.2
Published
Gardr plugin for requesting replacement with Postscribe from inside of an iframe
Downloads
6
Maintainers
Readme
Gardr Postscribe Plugin (Ext)
Gardr plugin to enable content rendering with Postscribe from inside of an iframe. It sends message to parent window which sould be caught gardr-plugin-host-postscribe.
Install
npm install gardr-plugin-ext-postscribe --save
Bundle
In your ext bundle file:
var gardrExt = require('gardr-ext');
var postscribe = require('gardr-plugin-ext-postscribe');
gardrExt.plugin(postscribe);
module.exports = gardrExt;
Usage
Set global variable _gardrPostscribe
to true
anywhere in script pointed by options.url or declare a custom function:
_gardrRunPostscribe = function(getHTML) {
_gardrRunPostscribe.getHTML = getHTML
}```
In host window:
```javascript
var gardr = gardrHost(...);
gardr.queue('ad', {
url: 'my-adserver.com/ad.js',
...
});
In my-adserver.com/ad.js:
window._gardrPostscribe = true;
or
window._gardrRunPostscribe(function() {
return '<script src="http://www.url.to.ad"></script>';
});