Created
August 25, 2015 18:50
-
-
Save bradvogel/6b195eac71217cd6d428 to your computer and use it in GitHub Desktop.
iframeProxy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
$(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