What is the Android source code

How do I view the source code in the Android browser?


Is there any way to view the source HTML in the Android web browser?

Reply:


You can use the method of Javascript to return the source code. Enter this in the address bar:






In Firefox or Chrome on Android, you can view the source code by prefixing the URL in the address bar with the prefix "", ie "".







Look for an app out there called View Web Source and install it.

Then, while browsing, open your menu and tap "Share". From the list that appears, choose View Web Source.







Create a new bookmark (bookmarklet) in Mobile Chrome with:

Name: show source text (vs)

Url:

Now tap the address field on any page and enter the following: vs. the bookmark should appear, click on it and you are ready to go.



If this is for debugging purposes (your comment indicates that it looks like this), it's even better to have a User Agent Switcher extension for Firefox or Chrome installed on your desktop. If you change the user agent to Android, you get the mobile version of the website, but with all the source and debugging tools you are used to.


You can capture the source code in your shell or in a text file using an emulator which is very handy for development. To do this, you need to install the Android Developer Tools that come with adb. Start your emulator and then run the following command in the shell of your operating system:

This outputs everything from the browser app on your emulator and suppresses all other log messages. From there, all of the JavaScript commands for console.log are captured and issued by adb for you to view. If you're using JQuery, you can add this to your page and print the entire HTML page to the log:

This will print everything in your HTML tag on the page in the log.

You can capture the output of your log (at least with BASH I can't talk to other shells) with:

Now every output from the log is written to the log.txt file. This is very useful for the HTML value of an entire page, as you can then search it like any other text document.

If you want to get a specific part of the page instead of the whole object, you can specify that part of the page instead of the HTML tag in your JQuery related to it (for this example it has a class called 'inspect-me') Modify your JQuery as follows:



If you're using an Opera browser, put this in your address bar and make sure you clear http and other data. Then enter the following:

in the address of the page you opened.


We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.