How to view web page source in Safari on iPad or iPhone

Have you noticed that there is no “View Source” in Safari?  This is a feature that I frequently use in desktop browsers such as Chrome.  Well, here’s a simple trick that quickly solves that.

Viewing the source code of a web page in Safari on your iPad or iPhone requires the creation of a “bookmarklet”.

A bookmarklet is JavaScript that is stored as a URL and then saved in your “bookmarks” list on safari.  So this means that when you select it from your list of regular bookmarks, it will run some javascript instead of connecting you to a normal destination URL such as a web site.

Here’s how you get it set up:

1. Navigate to this web page on your iPad or iPhone.

2. Open the file in this link – iPad View Source Bookmarklet and then select all and copy to the clipboard.  It is in a seperate text file so that your browser doesn’t try to change any of the actual text.

3. Select “Add Bookmark” from the “share” menu

4. Change the name to “iPad View Source” or whatever else you would prefer

5. In the second field (where you currently see a URL), replace that with the the contents of the file you opened in step 2 above – paste it in here.. as is.

5. Press Save.. and then give it a go.

Now try it – you should get a new tab created with the source code for whichever web page you are currently viewing.






, , ,

One Response to How to view web page source in Safari on iPad or iPhone

  1. Ivesomthingtosay March 1, 2012 at 10:59 pm #

    iCab also does this, and so much more. Worth a look and Universal. 

    The biggest thing I use it for is the download manager. You can download any file, view if there’s a universal plug-in, do things like rename the file, and “open in” any supported app. I use this feature to read Scanlations of Japanese Manga (yeah, I buy the official English translation too, but as that is 3 or 4 volumes behind, I like to read my Manga as it happens.) The way it works is, download a .ZIP or .RAR file with the content inside, rename the file to .CBR or .CBZ (hopefully the correlation is fairly obvious) and then “open in” my preferred reader (ComicBookLover.) This process takes seconds, whereas the old method of using a desktop and iTunes was monolithic.iCab also impersonates other browsers and about a zillion other things… too many.. so many I’d urge you to check out the author’s page.