I am looking to do a couple things:
- Create a bookmarklet that loads and runs the code in an external script
- The external script should load jquery via Google's CDN and run a function once it is fully loaded.
Is this possible?
I am looking to do a couple things:
Is this possible?
Yes.
http://benalman.com/projects/run-jquery-code-bookmarklet/
And code to use an external file as a bookmarklet:
document.body.appendChild(document.createElement('script')).src = 'http://domain.com/script.js';
Note, if you use the code from the link as your bookmarklet, and that loads the external script, you probably want the code from your external file to be able to use jQuery. In which case you need to remove .noConflict(1)
from the code in the link.
Another, probably better, approach is to use the code from the link inside your external file, and replace /* YOUR JQUERY CODE GOES HERE */
with your own code.