Skip to content

Instantly share code, notes, and snippets.

@bradvogel
Created August 25, 2015 18:50
Show Gist options
  • Save bradvogel/6b195eac71217cd6d428 to your computer and use it in GitHub Desktop.
Save bradvogel/6b195eac71217cd6d428 to your computer and use it in GitHub Desktop.
iframeProxy.js
/**
*
*/
$(window).on('message', function(e) {
var data = e.originalEvent.data;
if (data.method !== 'createIFrame') return;
var proxyUrl = chrome.runtime.getURL('/src/iframeProxy/proxy.html');
var iframe = $('<iframe></iframe>').attr('src', proxyUrl + '?proxy=' + encodeURIComponent(data.payload.src));
$('#' + data.payload.placeholderId).replaceWith(iframe);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment