iPhone/iPad view source Bookmarklet

javascript:var%20sourceWindow%20%3D%20window.open%28%27about%3Ablank%27%29%3B%20%0Avar%20newDoc%20%3D%20sourceWindow.document%3B%20%0AnewDoc.open%28%29%3B%20%0AnewDoc.write%28%27%3Chtml%3E%3Chead%3E%3Ctitle%3ESource%20of%20%27%20%2B%20document.location.href%20%2B%20%27%3C/title%3E%3C/head%3E%3Cbody%3E%3C/body%3E%3C/html%3E%27%29%3B%20%0AnewDoc.close%28%29%3B%20%0Avar%20pre%20%3D%20newDoc.body.appendChild%28newDoc.createElement%28%22pre%22%29%29%3B%20%0Apre.appendChild%28newDoc.createTextNode%28document.documentElement.innerHTML%29%29%3B

Just pop that into the bookmark address - name it view source - click the bookmark to see the source of any page!

Sounds cool, Eric. Can you elucidate on the install process a bit? “Just pop that into bookmark address” means nothing to me. :slight_smile:

I understand. There are a lot of things that mean nothing to me. Sort of like going about my daily job I guess. Easier to do than to explain the order. Here ya go…

With your iphone or ipad copy and paste that code >> while on the same page you just copied the code bookmark the Sitepoint page >> rename it to “View Source” >> Save and exit >> Now on your iphone/ipad click on your bookmarks icon >> navigate to the folder you bookmarked “View Source” >> Click Edit in top right (on ipad) >> Click “View Source” bookmark you just made >> Click in the box under the name of “View Source” (AKA the URL address) >> Select all and backspace to delete >> paste in your code you copied in first step >> Exit >> load up a page >> and click the “View Source” bookmark you made >> If you did it right it should show the source code for the page.

Lot of steps I guess for a simple thing.

As a side note: You can do the same thing with firebug light.

Thanks for attempting to explain it, Eric. Of course, I can’t even work out how to “copy and paste” on this ****ing iPhone, so I haven’t gotten too far yet.

Edit:

OK, finally worked it out, after trying several failed online attempts to explain it. Unfortunately, after following all those steps a few times, I don’t get any source view. O well … I learned something, anyhow. :slight_smile:

Here try this page Ralph. Youll have a better copy paste with this. http://www.visibilityinherit.com/code/iPhone-iPad-view-source-code-bookmarklet.php. Sometimes it’s hard to copy with scroll bars. So I got ride of them for iphone/ipad. I just tested it using my sites link and my iphone and it works perfect.

Ha ha, thanks Eric. Worked that time. :slight_smile:

I’ll tweet it. :slight_smile:

Oh good I’m glad it worked for you

This one is even better http://snoopy.allmarkedup.com/

Thanks. Will check it out. :slight_smile:

Have decided to try the easy way of implementing it (by doing it via desktop Safari). Now I just have to wait until iCloud updates. Seems to take forever. Does anyone know how to push it along, or why some things update and others never do (like some contacts)? The whole iCloud thing seems flaky at best to me. Sometimes I’ll update a contact, and even days later that new info hasn’t synched across devices, while other changes synch instantly. Just don’t trust it at all. :rolleyes:

Cool I found a way to bring up the iPhone/iPad keyboard while putting that code in a div or pre. Otherwise the keyboard only pops up with form elements. Thats why most people drop it into textarea. That makes it easier to select all.