This project contains a just some samples on how to configure different social media widgets using Garðr. The sample runs the IFrame from a different origin, showing how data leackage can be prevented.
'use strict';
var manager = require('gardr-host');
document.addEventListener( 'DOMContentLoaded', function(){
manager.config('twitter-content', {
width: '100%',
height: '20px',
data: {
'href': 'http://twitter.com/gardr',
'lang': 'en',
'showCount': 'false'
}
});
manager.queue('twitter-content', {
url : 'http://127.0.0.1:1339/twitterBundle.js',
container : 'twitter-container'
});
manager.renderAll();
}, false );
You can use the same configuration with an existing gardr configuraiton. All you need to do is to configure new placements like in the sample above.
All the sample code is located in the samples folder.
$ npm install && npm start
This opens up the URL http://localhost:1338/. The samples all render their content from what is a different host http://localhost:1339/iframe.html, see Same Origin Policy, this prevents the IFrame content from retrieving data from the host document.