Most of the times, when we visit a nice looking website, we always want to look at it’s HTML source code. On desktop browsers, we simple just right-click and click on “view page source” from the context menu but there’s no option like this on mobile devices. So then, how do we view the source code on a mobile device?
If we are to observe carefully, whenever we click on “view page source” on a desktop browser, it opens a new url in this format view-source:https://path/to/url
.
If we apply this same trick on a mobile device, it works as expected.
Steps to view source code
Visit the website which you want to view it’s source code.
Click inside the address bar and append
view-source:
before the url of the website.
Click the send button and the page will load with the source code of the file.
NB: Even though I used Chrome’s mobile browser, the method is the same in all the major browsers.