Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Image Drag bookmarklet fixed

Boris Zbarsky offered a fix for my image drag bookmarklet’s problems in Strict doctype pages. The problem was due to Mozilla, when operating in strict mode, refusing to absolutely position elements that don’t have a unit of measurement specified. The bookmarklet now works perfectly on pretty much every page I’ve tried it on.

Image Drag

This is Image Drag bookmarklet fixed by Simon Willison, posted on 13th February 2003.

View blog reactions

Next: Classes for pages

Previous: Indexing hypertext

8 comments

  1. You mean the problem was due to Mozilla doing the right thing...

    Ian Hickson - 14th February 2003 13:56 - #

  2. I wonder if something similar could be used to reposition absolutely positioned DIVs on a page.

    Joshua Kaufman - 16th February 2003 22:10 - #

  3. Am I the only one who gets an error with this? When I try it out with IE 6 / Win XP, it gives a "not implemented" error on line 174 (where there's a document.createElement('img')). Not sure why that is. I even got that error when trying it on this very page.

    Slime - 11th April 2003 21:54 - #

  4. It doesn't work with IE unfortunately - at the moment it's Mozilla/Gecko-engine only.

    Simon Willison - 14th April 2003 11:46 - #

  5. Oh, this is neat. I don't know what I'll use it for, but it's amusing nonetheless.

    Peach - 3rd June 2003 08:25 - #

  6. Using a variation of this to reposition DIVs would indeed be sweet.

    I'd like to see it combined with this effect. Talk about rapid prototyping!!

    Chris - 9th April 2004 21:29 - #

  7. Why does this bookmarklet destroy the IMG and create a new one instead of just making the old IMG draggable? (If document.createElement is the only thing IE doesn't support, changing that would probably make it work in IE.)

    Jesse Ruderman - 13th April 2004 05:47 - #

  8. Well, document.createElement usually does work in IE. Or at least that's what I thought.

    http://msdn.microsoft.com/workshop/author/dhtml/re ference/methods/createelement.asp

    Microsoft says it does.

    It worked in David's mark external links code he used to use.

    Tom - 13th April 2004 18:02 - #

Comments are closed.

Previously hosted at http://simon.incutio.com/archive/2003/02/13/bookmarkletFixed

A django site