Created
January 21, 2014 04:37
-
-
Save pirate/d2660ce9491584ca3de4 to your computer and use it in GitHub Desktop.
Inject JS/CSS into tabs using the Chrome Extension API (continued)
From http://stackoverflow.com/questions/6803840/chrome-extension-inject-javascript-into-a-webpage-to-perform-a-ajax-request
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
function exec(fn) { | |
var script = document.createElement('script'); | |
script.setAttribute("type", "application/javascript"); | |
script.textContent = '(' + fn + ')();'; | |
document.body.appendChild(script); // run the script | |
document.body.removeChild(script); // clean up | |
} | |
// with the below added to the manifest file | |
exec(function() { | |
$("body").load('hacked.html'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment