Viewing HTML Source Code On iPhone and iPad

As a new software engineering student I noticed a limitation when trying to test out my webpages on either my iPhone or iPad, there is no built in functionality to "view source page source". Sure, there are third party apps that do this plus much more but I just wanted a built in option right in my Safari mobile browser.

With a little googling I found there is a way and it starts with an app that every Apple device has called Shortcuts. You can use this app to build custom shortcuts that can be added to your browser actions. You can do a lot more with the Shortcuts app. (The gifs in this post were created using a shortcut!)

No alt text provided for this image

Once there hit the + in the top right corner to add a new shortcut. You can set the name, icon and icon color.

No alt text provided for this image

Then it is time to "Add Action" and search for and choose "Make HTML from Rich Text". Click the settings icon in the upper right and turn on "Show in Share Sheet". Add another action, search and choose "Quick Look".

No alt text provided for this image

All that is left to do now is test it out. Go to any webpage in Safari and hit the action button, then choose "View Source" and Voilà, source code!

No alt text provided for this image
Amit K

Website Genuine Page Speed, Core Web Vitals Expert at No Any Company

3 周

I have developed an utility to view page source of any web page in mobile or similar devices. Mt View Page Source utility is robust and simple: https://agalaxycode.blogspot.com/2025/03/view-page-source-in-mobile.html

Oskari Kolehmainen

System Specialist 2nd

5 个月

This is superb! Thank you ????

回复
Omar Shishani

Front-End Web Developer Specializing in React, JavaScript, PHP, & WordPress

8 个月

Awesome thank you! Here is a video showing how I did it on my phone in what I think is the new ios: https://youtu.be/K5fHWlgnFXQ

回复
Jean-Baptiste Caillau

Professor at Université C?te d'Azur, CNRS, Inria, LJAD

1 年

Jay Setlock???????? excellent: very useful, many thanks. nb: do not choose "make full document"

Megan T.

Small Business Owner | Knowledge Seeker & Avid Learner | All Things Business |

1 年

Thank you! I could’ve sworn I used to be able to view source via my phone, but I guess not ??♀?

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了