View source with a bookmarklet

Some web­sites try the some­what lame tech­nique of using Javascript based "obfus­ca­tion" for their HTML. At other times, IE will just refuse to view source if your sys­tem is low on mem­ory (accord­ing to IE's reck­on­ing that is) or if your temp space is full. Here is a handy book­marklet to view source in any browser.

Some web­sites try the some­what lame tech­nique of using Javascript based "obfus­ca­tion" for their HTML. At other times, IE will just refuse to view source if your sys­tem is low on mem­ory (accord­ing to IE's reck­on­ing that is) or if your temp space is full. Fol­low­ing are a cou­ple of handy book­marklets to view source in any browser.

IE View Source
Drag this link to your browser bar

The fol­low­ing book­marklet will work with any browser on any plat­form using the view:source direc­tive. It prompts you for the URL you wish to view source of (defaults to the cur­rent URL for con­ve­nience) and opens the usual source viewer asso­ci­ated with your browser. Note that this may not work for non-IE browsers on Macs (because Mac doesn't sup­port the view:source direc­tive) so you will be for­warded to http://sniptools.com/viewsource/ instead which shows you the text.

Generic View Source
Drag this link to your browser bar
10 comments
  1. mandy says: May 28, 20034:55 pm

    In Mozilla, you can use the DOM inspector.

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

    It's that simple!

  2. sniptools says: May 28, 20037:31 pm

    Thanks Mandy, didn't know about that!

  3. tripleaxis says: Jul 01, 200312:20 am

    love the IE View source link. good idea :)

  4. CodeHouse.com says: Jul 07, 20038:11 pm

    Hi,

    "IE View Source" is almost iden­ti­cal our DHTML Snoop: http://www.codehouse.com/javascript/favelets/dhtml_snoop/

    The "Generic View Source" book­marklet is a good idea, yet I think it might be bet­ter if it auto­mat­i­cally brought up the page with­out the prompt dia­log, like "IE View Source." I had actu­ally 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: Jul 09, 20031:56 pm

    Thanks for the link, Code­house. The GENERIC VIEW SOURCE is eas­ily mod­i­fied I imag­ine to remove the PROMPT, given that the audi­ence for this kind of stuff is most likely tech-literate. Inter­est­ing web­site btw.

  6. CodeHouse.com says: Jul 10, 20036:36 pm

    Thank you. You're quite wel­come for the link. I often post stuff for the web­site when half asleep, which may account for why I had dif­fi­culty get­ting the view-source favelet to work, but I do remem­ber it being prob­lem­atic. Pro­vided nobody beats me to the punch, I will try to tackle the prob­lem again later this month. One prob­lem with using the view-source URL pre­fix is that Opera doesn't sup­port it. I haven't tested whether Safari does. My hunch is not.

  7. CodeHouse.com says: Jul 16, 20033:19 pm

    Hi. Made a view-source favelet with­out the prompt, in case anyone's interested.

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

  8. Hgh says: Feb 13, 20047:05 am

    Hi, Thank you for such an infro­ma­tive web­site. Very inter­est­ing and easy to com­pre­hend! Thanx!

  9. Prasad says: Apr 02, 20053:32 pm

    why Generic view source code is not work­ing in win­dows XP. please send me answer asap

  10. sniptools says: Apr 02, 20054:44 pm

    Prasad, if you have SP2 installed, your IE may be hard­ened beyond what you expect it to. Please make sure the popup blocker is not block­ing. The book­marklet is setup to show page source in a NEW WINDOW, so it requires a popup, tech­ni­cally. Works on IE here for me, even with Max­thon or Slim­browser skins.

Submit comment