Created
June 10, 2014 08:27
-
-
Save viko16/b53a0658481448cf73d2 to your computer and use it in GitHub Desktop.
方便在chrome插件中插入js代码 #javascript
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 insertScript(path) { | |
var script = document.createElement('script') | |
script.src = chrome.extension.getURL(path) | |
document.body.appendChild(script) | |
} | |
// insert patch sdk | |
insertScript('patch.js') | |
/* | |
需提前在manifest.json中填写好: | |
"web_accessible_resources": [ "patch.js" ] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment