Created
July 19, 2013 17:27
-
-
Save lilliealbert/6040889 to your computer and use it in GitHub Desktop.
javascript bookmarklet hell
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
javascript:(function() { | |
var jsCode = document.createElement('script'); | |
jsCode.onLoad = function(){console.log('onLoad anon funtion called')}; | |
jsCode.setAttribute('src', 'http://localhost:3000/test.js'); | |
document.body.appendChild(jsCode); | |
})(); | |
// if the console.log is inside of an anonymous function, it never gets called | |
// the onLoad call also doesn't seem to be able to see anything defined in the test.js file :( |
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 testFunction(){ | |
console.log("made it into the test function"); | |
} | |
testFunction(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment