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.