-
-
Save tallykatt/56d8394150fc47001b11fb057db0e249 to your computer and use it in GitHub Desktop.
Simple code snippet for loading external script from a bookmarklet.
This file contains hidden or 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
/** | |
* load-external-script-snippet.js | |
* Kosei Moriyama <[email protected]> | |
* | |
* Simple code snippet for loading external script from a bookmarklet. | |
* Replace example url of script to your target script url before use. | |
*/ | |
(function() { | |
var u = 'http://example.com/bookmarklet.js'; | |
var s = document.createElement('script'); | |
s.type = 'text/javascript'; | |
s.charset = 'utf-8'; | |
s.src = u; | |
document.body.appendChild(s); | |
})() | |
// compressed version | |
javascript:(function(d,u,s){s=d.createElement('script');s.type='text/javascript';s.charset='utf-8';s.src=u;d.body.appendChild(s)})(document,'http://example.com/bookmarklet.js') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment