As the natural extension of Gareth Rushgrove’s bookmarklets for inserting the Dojo or YUI Javascript toolkits mentioned by Simon, here’s a tidying-up of a bookmarklet I’ve been using to bring in any Javascript using user input via a popup prompt:
javascript:void(function(){
var%20s=document.createElement("script");
s.src=prompt("Full%20URL:");
document.getElementsByTagName("head")[0].appendChild(s);
}())
I was originally appending it to the body as an invisible div, making use of d.innerHTML
to add both src and type attributes so as to make sure the browser won’t ignore it. The above based on Gareth’s seems to work fine, though.
Comments
David (not verified)
Mon, 10/12/2007 - 11:30
Permalink
JP - you need to escape the
JP - you need to escape the "s in your bookmarklet, otherwise it gets truncated.
jps (not verified)
Mon, 10/12/2007 - 11:39
Permalink
You're quite right, David:
You're quite right, David: that's what comes of posting at 4am. Fixed now.
Graceful Exits ... (not verified)
Thu, 20/12/2007 - 21:08
Permalink
[...] Let’s instead assume
[...] Let’s instead assume you’re following my every word. For this next bit, you’ll need Firefox and Firebug, or to stuff all these instructions into a single file. Otherwise, you’ll have to take my word for it. Firstly, I’ve included jQuery on every page of my blog, so if you’ve got the ‘bug then you don’t have to resort to my insert-JS bookmarklet to squirt it in. [...]