UPDATE: Thank you to Rixtur for the update for iOS 6. Steps updated.
I’ve been enjoying the iPad quite a bit. This device is going to change everything. I have lots of thoughts, one of which is that the iPad will be a high productivity device. Feeding into that, here’s a quick way to view the html, css and javascript source code of a web page from Safari on the iPad.
This guide is adapted from Dustin Caruso’s note on viewing source in Safari for the iPhone.
1. Visit this page using Safari on your iPad.
2. Use your touch selection skills to copy the following line of javascript:
3. Tap + then Add Bookmark (Note, you can not bookmark a blank tab, so you must visit another web page first to do this.
4. The first text field is the Title field. Change the title to View Source. Leave the second field (the Address Field) alone and hit save.
5. Tap the Bookmarks icon and then edit. Find View Source in the list and tap the right arrow for the bookmark’s details. Now tap the Address Field and hit the X icon to clear it. Tap and paste the javascript from the clipboard.
5. Tap the Bookmarks navigation item to save the changes.
Voila. Go to any web page using Safari, tap the Bookmarks icon and hit View Source. Safari will open a page of source code in plain text in a new window.
Thanks very much – a great debug tool.
Thanks a lot !!
most useful tip ever.
best regards from Hamburg
Hey Thanks a lot for this… got me out of a jam this morning. Very useful!
Nice tip that… I’ve been struggling with how to view source on the iPad for a while. Thanks 🙂
Excellent tip! Thanks for providing much needed functionality for Safari on iPad.
Great !
Thank you !
Worked like a dream. Thanks so much for the hack.
Thank you! Very cool!
Wicked tip. Thanks!
Very cool. Thank you. Anyone know of an editor app?
Fantastic tool!
Genius – ta vm …
P xxx
Thanks Rob!
Thanks Rob! Nice tip!
Nice! Awesome trick man needed that
Thanks a lot … you just saved me of hours and hours of pain.
Great tip! Thank you!
Thank you 🙂
Brilliant tip! Thanks!
Thanks! This tip was lifesaver.
Cool ! thanks you so much !
Awesome tip! Thanks alot.
Thank you very much for this!!!
Thanks Rob…it was a need to be fulfilled and you certainly did it!
Very useful! Thanks for this.
Great info. Works great, thatnks
Only shows from head? I wouldn’t normally care except for the only thing I needed to see the source for was to see what classes modernizr added to html :{
Thanks a lot man! Excellent tool +2334235564563457
Great!!!
Grazie.
Thanks for the tip, it worked like a charm. Only question is this, is there a way to copy the text from the source code, so I can paste it in another document?
Thanks.
Kl thanks for that..it’s pretty pimp 😉
The ipad2 does let you edit the bookmark content. Suggestions?
Excellent! thank you
Useful jscript, but he dont formating innerhtml throught new row
Awsome!
Thank you so much for the post!
That is awesome! U rock!!!
Works a treat!
Thanks!
Thanks a lot!!!
Great post – works like a dream.
Thanks
Wow, best tip ever! Been struggling with this some time. Did a Google search for source code on iPad and viola!! Thanks much!!
You are awesome! Thanks buddy!
Awesome ! Thanks a ton …
Is there a way to somehow copy that source code and paste it in a document / email as well ?
Rob,
Great tip. Thank you for that bit of JavaScript magic. Apple products: A child of two could use one… as long as you use it the way Apple wants you to!
Phil
Is there anyway for you to improve it so it allows us selecting some text of the source code to copy/paste ?
Nice! Thanks!
Great!!
This is great. Great directions, simple and easy to implement. I use the iPad in place of my laptop so much, especially for researching websites. This is awesome. Thanks so much for sharing! – Bob
You can have CodeNavigator in iPad have a try
Thanks a bunch!!!
Thank so much man
Thank you very much!! :€
GREAT!!!
Thanks,
add to this, do you know how to copy all this source and send to email or twitter?
Thank you! Just what I needed this morning!
Fantastic tip, was super helpful for a problem I was haing today, thanks!!
Excellent tool. Thanks for posting.
Hello, thanks for putting this online (with all the other great resources). Am currently on vacation away from my computer and I was stumped with only my iPhone to debug a website.
Thanks again, really made my trip better.
Thanks, works like a champ.
Thank you!
Ive created a slightly different version which takes the entire DOM and uses GeSHi to enable syntax highlighting, clickable links and selectable text. I’ve described the process here: http://blog.grapii.com/2012/07/view-source-of-a-web-page-on-ipad-iphone-or-ipod-touch-using-mobile-safari/
Great tip! This was the missing piece of the iPad experience for a curious web designer. “You complete me!”.
This is great however, my ipad won’t select all of the text so i can use it on my PC, ideas?
I cannot work out how to do this. I can selec the text, but dont understand what “tap + then add bookmark”. What should I tap?
1) the “+” on the keyboard. This doesnt work.
2) the text I have just copied? It just unhighlighs the text
3) There is no “+” on the browser top nav like in the screen shot in the IPAD 3. There is a “+” to add new tabs, but this doesnt have anything to do with it I presume.
So cant work out how to get this tip to work in ipad3.
This work so good. Like it love it. Genius use of javascript parsing techniques intrinsic to the broswer. Fresh fresh very fresh
Does not work on iOS 6
What doesn’t work in iOS 6 is step #3, because Safari won’t let you create a bookmark of a blank tab. But you can do it if you just bookmark this blog article, change the Title to “View Source” and follow the rest of the steps.
Works great! Thanks!
I have iOS 6.0.1. Works great. Thank you.
Thanks for that comment Rixtur, I’ll update the entry.
Awesome! Exactly what I needed. Comparing code on two web-sites. Using my iPad 2 (iOS 6.1), don’t have my laptop with me today. Found this – problem solved!
Omg thanks It really helped!!
Many thanks for your useful tips. It worked perfectly on my iPad with iOS 6.1.2.
Thanks a bunch!
Amazing
Awesome trick. Sharing is caring.
Nice Tip. Thank you
I tried to add this to the iPad with iOS7 today on May 12, 2014. But when I tried to create a bookmark, I can sure edit the title but not the address field. So cannot paste the JS code in the address bar.
Am I doing something wrong?
Thanks.
I got the source code view on the iPad with iOS7 now, but with VoiceOver, it reads it as a chunk. I cannot navigate the code by line or word etc. Sothat seems to be a barrier.
Thanks
This still works. Thanks for saving me some pain!