View source with a bookmarklet

Some websites try the somewhat lame technique of using Javascript based “obfuscation” for their HTML. At other times, IE will just refuse to view source if your system is low on memory (according to IE’s reckoning that is) or if your temp space is full. Here is a handy bookmarklet to view source in any browser.

Some websites try the somewhat lame technique of using Javascript based “obfuscation” for their HTML. At other times, IE will just refuse to view source if your system is low on memory (according to IE’s reckoning that is) or if your temp space is full. Following are a couple of handy bookmarklets to view source in any browser.

IE View Source
Drag this link to your browser bar

The following bookmarklet will work with any browser on any platform using the view:source directive. It prompts you for the URL you wish to view source of (defaults to the current URL for convenience) and opens the usual source viewer associated with your browser. Note that this may not work for non-IE browsers on Macs (because Mac doesn’t support the view:source directive) so you will be forwarded to http://sniptools.com/viewsource/ instead which shows you the text.

Generic View Source
Drag this link to your browser bar
This entry was posted in Miscellaneous and tagged . Bookmark the permalink.

10 Responses to View source with a bookmarklet

  1. mandy says:

    In Mozilla, you can use the DOM inspector.

    (1) Open page in Mozilla DOM Inspector.
    (2) Right click on top node.
    (3) Copy XML.
    (4) Paste in text editor.

    It’s that simple!

  2. sniptools says:

    Thanks Mandy, didn’t know about that!

  3. tripleaxis says:

    love the IE View source link. good idea :)

  4. CodeHouse.com says:

    Hi,

    “IE View Source” is almost identical our DHTML Snoop: http://www.codehouse.com/javascript/favelets/dhtml_snoop/

    The “Generic View Source” bookmarklet is a good idea, yet I think it might be better if it automatically brought up the page without the prompt dialog, like “IE View Source.” I had actually tried to do this myself at one point, but ran out of time and patience, and so put it on the back burner.

  5. sniptools says:

    Thanks for the link, Codehouse. The GENERIC VIEW SOURCE is easily modified I imagine to remove the PROMPT, given that the audience for this kind of stuff is most likely tech-literate. Interesting website btw.

  6. CodeHouse.com says:

    Thank you. You’re quite welcome for the link. I often post stuff for the website when half asleep, which may account for why I had difficulty getting the view-source favelet to work, but I do remember it being problematic. Provided nobody beats me to the punch, I will try to tackle the problem again later this month. One problem with using the view-source URL prefix is that Opera doesn’t support it. I haven’t tested whether Safari does. My hunch is not.

  7. CodeHouse.com says:

    Hi. Made a view-source favelet without the prompt, in case anyone’s interested.

    http://www.codehouse.com/javascript/favelets/view_source/

  8. Hgh says:

    Hi, Thank you for such an infromative website. Very interesting and easy to comprehend! Thanx!

  9. Prasad says:

    why Generic view source code is not working in windows XP. please send me answer asap

  10. sniptools says:

    Prasad, if you have SP2 installed, your IE may be hardened beyond what you expect it to. Please make sure the popup blocker is not blocking. The bookmarklet is setup to show page source in a NEW WINDOW, so it requires a popup, technically. Works on IE here for me, even with Maxthon or Slimbrowser skins.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>