View DOM Source Bookmarklet

There aren’t many things I don’t like about Firefox, but there is one that constantly drives me nuts: that the View Source command actually goes back to the server to get the source of the page you’re currently viewing. Why doesn’t it just display the source from cache?

I’m sure they figure it’s the same thing, but sometimes it’s not. Take the Google X debacle. I had it still up on my screen but was unable to see the source code for the page. So I quickly wrote a little bookmarklet that would do the deed for me.

You can bookmark it directly here: View DOM Source. Remember, this only works in Firefox (or other Mozilla-based browsers).

Essentially, this bookmarklet uses the XMLSerializer object to serialize the page’s DOM representation. If the page uses little or no JavaScript, this will be essentially equal to the source. If the page’s code is modified by JavaScript, it will display the code with the modifications. Hope you all find this as helpful as I have!

New in the Store

My Code Sparks Joy (Sarcasm) T-shirt

Join the Mailing List

Never miss an update by joining 3,000 other mailing list members.