[No App Required] How to view page HTML source code on iOS and Android
![[No App Required] How to view page HTML source code on iOS and Android](img/ogp.png)
Compatible with both iOS and AndroidHere's how to display HTML source code in your smartphone browser.
Table of Contents
For iOS
For iPhone and iPad, you can display HTML source code using a bookmarklet.
You can use it with either Safari or Chrome browsers!
① First, to create a temporary bookmark, bookmark this page anywhere you like.

② Next, copy the following code.
javascript:(function(){var a=window.open('about:blank').document;a.write('<!DOCTYPE html><html><head><title>ViewSource:'+location.href+'</title><meta name="viewport" content="width=device-width,initial-scale=1" /></head><body></body></html>');a.close();var s = a.createElement("script");s.src = "https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=sons-of-obsidian";a.body.appendChild(s);var b=a.body.appendChild(a.createElement('pre'));b.className='prettyprint lang-html linenums';b.style.overflow='auto';b.style.whiteSpace='pre-wrap';b.style.wordBreak='break-all';b.style.fontSize='11px';b.appendChild(a.createTextNode(document.getElementsByTagName('html')[0].outerHTML))})();
If it doesn't work, try copying the text from here.
③ Edit the bookmark you just added.

From this

Edit it like this.
For Title, use any name you like.
For Address, paste the code you just copied, and save with "Done".

Now the setup is complete.
How to use
With the target page open, open your bookmarks.

Open the bookmarklet you created.

The source code is now displayed.

You can zoom in or copy the text.
It was also confirmed to work similarly in Chrome on iOS.

For Android
For Chrome on Android, simply add view-source: to the beginning of the URL.
For example, for a URL like this:
https://www.google.co.jp/
Open the page like this:
view-source:https://www.google.co.jp/
Then the source code will be displayed.

The text is small, but you can zoom in or copy it.
Also, the bookmarklet method introduced in the iOS section was not confirmed to work in Chrome on Android.
Comments
-
#001
Anonymous
Amazing!
-
#002
Owner
Thank you!
-
#003
Anonymous
That's fake.
-
#004
Owner
Thank you for your feedback!
I had indeed confirmed its operation when creating the article, but upon checking now, I found a bug and have cleared the article.
Thank you very much for reporting it.
-
#005
Anonymous
That's impossible, isn't it?
-
#006
Owner
Thank you for your comment.
I have confirmed it works on both iOS and Android in my environment, but
Could you please tell me about your environment?
-
#007
Anonymous
I was able to do it with Safari, but is it not possible to rewrite it?
-
#008
Owner
You cannot rewrite it!
Please use a dedicated app or a PC's developer tools!




If this was helpful, we appreciate your support!
Any support received will be used for childcare.
Or support us by buying something from the buttons below
(You don't have to buy the linked product.)
Amazon
Rakuten Ichiba
Yahoo! Shopping
PR