• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

AppleToolBox

Tools and Fixes for Mac, iPad, iPhone & iWatch

Search posts

  • About
  • Contact

CONNECT WITH US

CATEGORIES

  • iPhone
  • iPad
  • iPod
  • Apple Watch
  • Mac/MacBook
  • AirPods
  • Apple TV
  • News
  • Apple Services
  • HomePod
  • Reviews

SITE

  • Home
  • About Us
  • Contact
  • Advertise

Search posts

You are here: Home / iPad / How to view webpage HTML source codes on iPad / iPhone. No app required.

How to view webpage HTML source codes on iPad / iPhone. No app required.

By Sudz Kar 54 comments Last updated December 30, 2022

Are you web-curious and want to take a peek at the source code of any website on the internet? If so, you are not alone. One of the most frequent reader questions we see is how to view HTML source codes from ANY webpage on an iPhone (or another iDevice–iPad or iPod Touch.)  Luckily, we have a solution thanks to Developer Rob Flaherty! This article outlines the steps required to view the source code (HTML, CSS, JavaScript, etc.) for any webpage on your iDevices including iPad, iPhone or iPod touch. And best of all, no app required!

Related Posts

  • How to view HTML source code in Safari

Contents

  • How to View HTML source codes on iDevices
    • 8 Easy Steps to see HTML source codes
    • End Results to View HTML source codes
  • And, Of Course, There’s an App For That!

How to View HTML source codes on iDevices

8 Easy Steps to see HTML source codes

  1. Tap Safari (iPhone, iPod, or iPad), if it is not already open, and visit this page. This method also works for Chrome
  2. Select the Share Button (also known as the Action button):Safari Tap
  3. Tap Bookmark:safari bookmark
  4. Choose the Name Field and hit the X icon to clear it and name it “Show Page Source” and then tap “Save.”Show Page Source
  5. Now visit this page and select all and copy the javascript code: (code credit: Rob Flaherty)copy code
  6. Confirm that the code you copy from Rob’s site looks the same as this (but copy from this page NOT from below):
    1. javascript:(function(){var a=window.open(‘about:blank’).document;a.write(‘<!DOCTYPE html><html><head><title>Source of ‘+location.href+'</title><meta name=”viewport” content=”width=device-width” /></head><body></body></html>’);a.close();var b=a.body.appendChild(a.createElement(‘pre’));b.style.overflow=’auto’;b.style.whiteSpace=’pre-wrap’;b.appendChild(a.createTextNode(document.documentElement.innerHTML))})();
  7. Tap the Bookmarks icon and tap Edit:edit safari bookmarks
  8. Select the “Show Page Source” bookmark you just created in step # 4:edit show page html css source bookmark
  9. Tap the Address Field and hit the X icon to clear it, then paste the javascript code you copied in step # 5; then tap Donecopy code bookmark

That’s it! Now you can use go to any webpage using mobile Safari (and Chrome) on your iDevice (iPhone, iPod, or iPad), tap the Bookmarks icon then tap the Show Page Source bookmark, and a new window opens displaying the source code of the webpage. Awesome and Easy!

End Results to View HTML source codes

show page sourcesee HTML code of a site

 

And, Of Course, There’s an App For That!

If you don’t like the idea of going through a bunch of manual steps, the App Store offers a few apps that do the work for you! Look for third-party apps like View Source, Source for Webpage, Source Browser, and similar apps that allow you to view HTML source code. With these apps, you get access to all your favorite site’s HTML source code, CSS, and on some apps, any Javascript. Some of these apps even offer a Safari extension for iOS devices and include built-in syntax highlighting and search features! How to view webpage HTML source codes on iPad / iPhone. No app required.

With these apps, viewing source code is a smooth, one-step process. Just enter a URL and immediately see the source code behind it. Or use the app’s Safari extension and browse the web as you usually would. Then, when you want to view the source for your current page, all you need to do is tap the Action icon and choose View Source. It’s easy to copy the text to your pasteboard for use in other apps or even send it as an email.

Related Posts:

  • pexels-tima-miroshnichenko-6860464
    How To Start Using Regex With The Shortcuts App
  • pexels-cottonbro-5474033
    How To Navigate Folders Using The Mac Terminal
  • How to View Web Page Source on iPhone iPad 7 Best Methods
    How to View Web Page Source on iPhone/iPad: 7 Best Methods
  • pexels-hana-mara-3650616
    The Best Homebrew Apps For Mac
  • The home screen on an iPhone
    iOS iPhone Visual Voicemail Not Working After iOS 17…
  • macOS Monterey Hero
    What’s New With macOS Monterey 12.3
  • A problem occurred with this webpage so it was reloaded, fix
    Safari: "A problem occurred with this webpage so it…
  • pexels-adam-fejes-5702341
    How To Download YouTube Videos To Mac Safely (and…
  • How To Use Tab Groups in Safari on iPhone and iPad Hero
    How to Use Web Inspector to Debug Mobile Safari…
sudz - apple
Sudz Kar

Obsessed with tech since the early arrival of A/UX on Apple, Sudz (SK) is responsible for the original editorial direction of AppleToolBox. He is based out of Los Angeles, CA.

Sudz specializes in covering all things macOS, having reviewed dozens of OS X and macOS developments over the years.

In a former life, Sudz worked helping Fortune 100 companies with their technology and business transformation aspirations.

Reader Interactions

Write a Comment Cancel reply

Show 54 Comments

  1. Kim says

    January 23, 2024 at 5:36 AM

    I have a solution, it has been thoroughly tested, and works regardless of what iOS device you own. Just follow the below steps:

    1. shut down apple device and put away for now.
    2. Locate a laptop running Windows or Linux (this may work for other desktop or laptop operating systems)
    3. Start laptop and open a browser
    4. Right click on browser while selected website is open and select “view source”

    I ABSOLUTELY GUARANTEE YOU THIS WILL WORK!

    It is also significantly faster than trying any of the suggested solutions on iOS devices!

    Reply
  2. Istvan says

    December 25, 2023 at 7:50 AM

    I have just tried and tested on my iPad using Chrome with the latest iOS and it works! Many thanks for this!!!!

    Reply
  3. Prince k. Diah jr says

    January 13, 2023 at 12:19 PM

    I do have iPhone 13 but it’s not opening.it has code on it they I saying only iPhone company can open it therefore I want know if you can open it and how it with cost for the code.

    Reply
  4. Hashim Hashim says

    December 15, 2022 at 12:28 PM

    Excellent and thank you for sharing.

    Reply
  5. Katy kaboom says

    January 21, 2022 at 1:14 AM

    This is AWESOME!!! Thank you so much!!!

    Reply
  6. Unjay says

    June 16, 2021 at 7:36 PM

    That is amazing!
    Thank you!

    Reply
  7. Nilesh sahu says

    February 16, 2021 at 8:26 PM

    So Impressed this hack very cool man thanks

    Reply
  8. Meg Torrie says

    May 27, 2020 at 3:51 PM

    Thank you so much!
    I wish I was smart enough to understand how and why this worked – but it DID work – and I’m like

    Woah!? No sh*t!
    It worked!!!

    You Rock!

    PS. As a 30 something who knows little more than how to use adv search operators, where would you recommend I start if I want to learn code? ‍♀️

    Any advice would be greatly appreciated!

    Reply
  9. Faruk SAHIN says

    November 25, 2019 at 7:34 AM

    This way of page source viewing can be used to inspect facebook pixel or google site tag codes? Any other option to chrck facebook pixel code on a page??

    Reply
  10. Tarek says

    September 7, 2019 at 12:49 AM

    Tested it on an iPad pro 12.9 2018 model with iOS 12.4.1. Works. Thanks so much for this!

    Reply
  11. William says

    April 19, 2019 at 10:26 PM

    Hello.

    I tried this idea and when I was finished I went to ROBLOX (because the asterisks was on my password and I forgot my password) clicked on bookmarks then clicked on Show Page Source it went to a new window but it was completely blank.

    There was no writing on it. Just pure whiteness. Can you tell me if I can get my password back

    Reply
  12. Jay says

    April 16, 2019 at 10:04 AM

    Since this is such a useful hack and still so often referenced but folks are sometimes frustrated with the inability to Select All/Save/Share etc. at times, if people don’t mind a little scripting, you can play with ‘the new freshness’ and use the code I wrote below in lieu of any additional workflow (or roll your own as you see fit, of course). But here’s the current approach to accomplish…

    javascript:(function(){var a=window.open(‘about:blank’).document;a.write(‘Source of ‘+location.href+’document.designMode = “on”;’);a.close();var b=a.body.appendChild(a.createElement(‘pre’));b.style.overflow=’auto’;b.style.whiteSpace=’pre-wrap’;b.appendChild(a.createTextNode(document.documentElement.innerHTML))})();

    The only really important addition in there is the document.designMode = “on”; between the tags which makes the resultant document editable by turning designMode on and thereby invoking the desired UIMenuController edit actions (i.e. Cut, Copy, Paste, Replace, Select, Select All, Formatting) plus your keyboard and all that jazz should you wish to add/edit/replace/format anything before sharing/saving to your destination, etc.

    Hope that makes some lives easier out there (or at least a little more efficient ; ).

    Cheers.

    Reply
    • SK says

      April 16, 2019 at 10:10 AM

      Jay,

      Awesome, thanks for sharing it!

      Reply
  13. Reynaldo Pakpahan says

    February 22, 2019 at 12:31 AM

    Awesome, it’s working!

    Reply
  14. Erma says

    September 22, 2018 at 7:43 AM

    I got to finally see my website code using my iPad Pro! A Big Thank YOU!!!

    Reply
  15. Charone Frankel says

    August 8, 2018 at 5:56 PM

    Awesome!!!

    Reply
  16. Richard Mahony says

    June 23, 2018 at 2:55 AM

    Nope. Completed all the steps in Safari on iOS 11.4 on 2017 128 GB iPad. Didn’t work. Did it again, still didn’t work. Shut down all open apps. Cleared all cookies from Safari. Opened Safari. Still doesn’t work on my iPad for any webpage.

    Completed all steps in Google Chrome on my iPad. Three times. Deleted bookmark, tried again. And again. Won’t work for any webpage.

    Reply
    • SK says

      June 29, 2018 at 9:27 AM

      Hi Richard,

      Thank you for the feedback. We just tested this on both Chrome and Safari and it’s working for us. The key is to copy the code from the link, rather than copying the code that’s written in the article. We’ve updated the article to reflect that change. Not sure why copying it from the article’s text isn’t working anymore–it used to!

      Sam

      Reply
      • Gian says

        December 3, 2018 at 9:02 AM

        Hi, I think the code in the article’s text doesn’t work because of the single quote symbol you used (maybe the problem is due to the font). Only this symbol is correct: location.href+’.
        You should replace them all with this one or with the code ' in your html source.
        By the way it’s a really cool tip guys! Thank you!

        Reply
        • SK says

          December 3, 2018 at 9:21 AM

          Thanks Gian! We appreciate the tip.

          Reply
  17. Jon Scott says

    June 15, 2018 at 5:35 PM

    iPhones/iPad are one of the best devices v=currenly present in the market. But to view the HTML source code in these devices is not a very easy thing.

    Reply
  18. Sybil N. Phillips says

    February 27, 2018 at 5:58 AM

    This is a problem that has gone on for about 2 months. I have been using my iPad for a lot of searching and especially for recipes. When I find one that I want, I email it to my computer. It ends up stuck in my “Outbox”. I can not get it out unless I delete it. I do not like to hand write something and then have to type it. Too time-consuming. When I search for “helps”, I get references to the “iO which is Greek to me. I have the same problems with items other than recipes that I would like to have copies of.
    You need to go back to what worked before the “iOS” were put in. All computer users are not highly trained technicians. I use mine for enjoyment.

    Reply
    • SK says

      February 27, 2018 at 11:06 AM

      Hi Sybil,

      I’m sorry to hear about your problems emailing recipes. It sounds like there is a problem with your email account, so we suggest removing your email from your iPad and then adding it back in. To do so, go to Settings > Accounts & Passwords > Select Your Email Account > Delete Account. Once deleted, restart your iPad and then return to Settings > Accounts & Passwords > Add Account. Then follow the on-screen steps to add your email account back to your iPad.

      If that option is not appealing, there are a few other things we can try:

        Force restart your iPad by pressing both Home and Power buttons and keep holding these two buttons down until the Apple Logo appears onscreen, then release them. Once rebooted, try to send a recipe again via your email

        Close both your Mail App and your Browser (Safari or other) by double tapping the Home button, locating the Mail App Preview and swiping up off the top of the screen, then do the same for Safari (or another browser app) by locating the app preview and swiping it up off the top of your screen to close. After both apps are closed, restart your iPad and try to email a recipe again.

        Put your phone in Airplane Mode (Settings > Airplane mode > toggle ON), delete all emails currently showing up in your outbox, then go back and turn Airplane Mode off. Restart your iPad and try again

      Let us know if the problem persists!

      SK

      Reply
  19. Alexander says

    January 16, 2018 at 8:04 AM

    I got to open the page with the code but it won’t let me edit it. How can I do that?

    Reply
    • Elizabeth says

      January 17, 2018 at 4:24 AM

      Hi Alexander,

      Are you trying to edit the source code of a webpage that you viewed using this method?

      Liz

      Reply
  20. Gail says

    January 7, 2018 at 8:55 AM

    Thanks! Works on iPhone 6 running iOS 11.1.1.

    Reply
  21. Jack says

    December 25, 2017 at 6:46 PM

    it wont let me edit the edit the words

    Reply
  22. Pranav says

    December 8, 2017 at 1:35 AM

    This works in iOS 11.2 also!!!!
    And in chrome also

    Reply
  23. Marina says

    September 15, 2017 at 2:21 AM

    worked!!! Thanks!

    Reply
  24. Keith says

    June 6, 2017 at 9:29 AM

    Fantastic – very helpful – thanks!

    Reply
  25. Jessica says

    May 6, 2017 at 1:02 AM

    Wow. What a hassle!

    Reply
  26. raffa says

    March 21, 2017 at 10:32 AM

    Great! thanks

    Reply
  27. Jim Reynolds says

    January 19, 2017 at 7:52 PM

    Once we can view a page’s source code, can we copy it? I’m not an apple person. I’m asking for a friend. She seems to be saying that she can view source code, but not copy it after “last year’s” iOS update. She uses a tablet and iOS.

    Reply
  28. Marty says

    January 12, 2017 at 1:01 AM

    Can’t get to stage 3. It doesn’t have bookmark. So tried adding one. That doesn’t work!

    Reply
    • Elizabeth says

      January 13, 2017 at 8:32 PM

      Hi Marty!

      Sorry these steps arent working for you. Try fully closing Safari by double tapping home, locathing safari, and then swiping up to close. Then head to settings>safari and make sure favorites is on.

      If you sync with icloud, head over to Settings > iCloud > Safari > and confirm its ON.
      Open Safari and try running through steps again to set a bookmark. To check bookmarks, tap the open book icon to the left of top address bar.

      For more detailed instructions, check out our article on Safari and bookmarks.

      Keep us updated and let us know if you still encounter problems,

      Liz

      Reply
  29. Vin says

    September 17, 2016 at 12:50 PM

    Thank you so much!

    Went past the command in red at Step 5 (view this page) a few times, but finally got through to your script to copy, and hey presto!

    Reply
  30. Ben says

    March 21, 2016 at 10:53 AM

    Works perfectly in iOS 9.2.1, thank you 🙂

    For everybody saying it doesn’t work, don’t forget to look at the opened tab in the background 🙂

    Reply
  31. 2meter says

    December 28, 2015 at 8:14 AM

    Doesn’t work (anymore?)
    Too bad…

    Reply
  32. Ali says

    October 12, 2015 at 2:48 AM

    Hi
    To viewing the html code is perfect but how can we copy that coding?
    Is their any solution please guide me?
    Thanks

    Reply
    • Nick says

      October 25, 2015 at 1:08 AM

      Just make an ‘edit page’ bookmarklet (search google) then just select that bookmarklet after the view source bookmarklet and you will be able to select/copy etc.

      Reply
      • Michel says

        November 7, 2015 at 7:34 AM

        Don’t work with iOS 9.0 & 9.1!…

        Reply
  33. Cathi says

    October 2, 2015 at 12:49 PM

    I guess a change needs to be made to the script so that it will work with the new iOS 9.x updates. Can you update the page when the change is made so that I can try this again? Thanks!

    Ps… I don’t mean to act demanding, this is just such a great trick and I’d like to be able to use it.

    Reply
  34. Michel says

    September 18, 2015 at 6:06 AM

    My message was erased! Here is again :

    This method does not work with the New iOS 9.0!

    Any solutions?

    Reply
  35. Michel says

    September 17, 2015 at 3:32 PM

    Don’t work with iOS 9.0!… Any solutions?

    Reply
  36. Umer says

    August 6, 2015 at 4:50 AM

    I followed all of the steps but when I go to see page source it opens a new tab which says:

    Any solutions?

    Reply
  37. Haley says

    August 4, 2015 at 4:04 AM

    Thank You! It worked. 🙂

    Reply
  38. Narender says

    June 30, 2015 at 11:23 AM

    Hi,
    How can we search the page source. No options . It was there in the earlier version.

    Reply
  39. thank you says

    April 12, 2015 at 6:18 PM

    Thank you.
    Thank you.
    Thank you.
    Thank you.

    Reply
  40. Joey says

    January 4, 2015 at 1:22 AM

    Thanks man

    Reply
  41. Anamca says

    January 3, 2015 at 12:09 PM

    Fantastic! Thanks so much, no longer have to crank computer into life just to see source code. You’re stars.

    Reply
  42. HunterJones says

    July 20, 2014 at 1:37 PM

    Hey, thanks! Why the heck Apple took this out is beyond me. I swear… Apple, I love usually you but I HATE you sometimes.

    Reply
  43. Tania says

    May 17, 2014 at 11:16 PM

    This is dope, this helped a lot. Thanks much! 🙂

    Reply
  44. Ben says

    April 18, 2014 at 3:00 PM

    Thanks for this!

    Reply
  45. John says

    March 22, 2014 at 10:35 AM

    Cool tip

    Reply

Primary Sidebar

Recent Posts

  • How to Fix Apple Music Crashing on Windows 11
  • How to Run Android Apps on iPhone Without Jailbreak
  • How to Share Screen on Teams on MacBook
  • How to Use Microsoft Teams on Mac for Collaboration
  • How to Fix Bad AirPods Sound Quality on PC
  • Use This Trick to Sync Apple Notes and Microsoft Word

Connect with us

Footer

ABOUT

  • About Us
  • Contact us
  • Advertise
  • Privacy
  • Terms of Use

GUIDES

  • iOS & iPadOS
  • Apple ID
  • iCloud
  • App Store
  • iTunes
  • FaceTime
  • iMessage
  • Siri
  • Books and iBooks
  • Game Center
  • AirPlay

CONNECT

  • Facebook
  • Twitter
  • FeedBurner
  • YouTube

© Copyright 2010-2024 Guiding Tech Media · All Rights Reserved

This site and its content are in no way affiliated or endorsed by Apple, Inc. · Reproduction without explicit permission is prohibited

Last Updated on December 30, 2022 by Mitch Bartlett