How to view source code of a webpage on your iPhone or iPad

We’re big fans of iOS 8’s new Extensions framework, and a new Extension by developer Paul Hudson lets you view the source code for a webpage, right within Safari.

You could view source code of a webpage previously, but you needed a dedicated app, and had to open the page in that app. This extension lets you view the syntax highlighted source code (HTML, Javascript and CSS) without leaving Safari.

Here’s how you do it:

  • Download and install View Source from this App Store link ($0.99).
  • Open the app once, and then hop back to Safari.
  • Open the webpage whose source you want to view in Safari.
  • Tap on the Share button to bring up iOS 8’s Share sheet.
Photo 25-09-14 10 25 57 pm
  • The second row of icons contains Action Extensions. Scroll to the right of this row to reveal the More icon, and tap on it.
Photo 25-09-14 10 26 00 pm
  • You should see a list of available extensions, scroll to the View Source extension, and enable it by turning on the toggle.
view source step 3
  • Now tap on the View Source icon.
view source step 4
  • You should now see a new screen with the source code of the page.
view source step 5
  • You can copy the source code to your clipboard or send it as an email.
view source share

This could be very useful to web developers who want to have a peek at the source code of their site, while they’re on the go.