How to access a web page's HTML source code?

Users of every major Internet browser can view the HTML source code of any online page. In the following sections, numerous methods for viewing the source code of each major browser are discussed.

Introduction:

The data and code handled by the server won't show up when inspecting the source code of a web page. As an illustration, a search engine processes data on a server before displaying the results on a web page. In other words, while the source code for the outcomes page may be examined, the source programs for the search engine cannot be viewed.

This guideline is applicable to all programming code, SSI, and server-side scripts. As a result, scripts used by search engines, discussion boards, polls, chat, etc., do not allow access to their source code. Furthermore, copying data from the source code can result in mistakes or send you back to the page from which you copied it. There are several search engines where we can access a web page's HTML source code. These are as follows:

Google Chrome:

Any of the following approaches can be used to read a web page's source code i Google Chrome.

Only access source code:

  1. Press the shortcut keys Ctrl+U on your computer's keyboard to display only the source code.
  2. To view the page source, choose View page source from the pop-up menu that displays when you right-click on a blank area of the website.

Using elements, view the page source:

  1. You may view the source code of a website by navigating it in Chrome.
  2. Click on the Chrome settings icon may be in the browser window's upper-right corner.
  3. Select More Tools from the open drop-down option, and then choose Developer Tools.
  4. The new section that displays at the bottom of the screen has an Elements tab in the top-left corner. Click it.

In Chrome, the interactive developer tool can also be used by hitting F12 or Ctrl+Shift+I. With this tool, users may engage more with the source code and CSS options and instantly observe how changes to the code affect the web page.

Mozilla Firefox:

Any of the following approaches can be used to read a web page's source code in Mozilla Firefox.

How to access a web page's HTML source code

View source code only :

  1. Press Ctrl+U on your computer's keyboard to just display the source code.
  2. From the pop-up menu, select View Page Source, which comes when you right-click on an empty section of the website.

Using elements, view the page source :

  1. To inspect a web page's source code, use Firefox and go to the desired page.
  2. To select the menu, there is a Firefox Menu Icon icon at the top-right of the screen.
  3. In the drop-down menu, choose More Tools; then, pick Web Developer Tools from the expanded menu.
  4. The area that displays at the bottom of the screen has a tab for Inspector in the top-left corner. Click that button.

Pressing F12 or Ctrl+Shift+I in Firefox also launches the interactive developer tool. With the help of this tool, users can interact with the source code and CSS options to observe how changes to the code are reflected in real-time on the web page.

View a portion of the source code for the page. :

  1. To look at a web page's source code, highlight the desired area.
  2. The View Selection option uses the context menu as a source when you right-click that highlighted area.

Microsoft Edge:

Any of the following approaches can be used to read a web page's source code in Microsoft Edge.

How to access a web page's HTML source code

View source code only :

  1. Press the Ctrl+U keyboard shortcut to examine only the source code.
  2. To view the page source, choose View page source from the pop-up menu that displays when you right-click on a blank area of the website.

Using elements, view the page source :

  1. To inspect a web page's source code, open Microsoft Edge and go to the desired page.
  2. The Settings and More Edge symbol is located in the top-right area of the screen. Click it.
  3. Select Developer tools from the expanded menu by moving your mouse over the More Tools drop-down menu.
  4. The window on the right side of the screen will have an Elements tab at the top.

Pressing F12 or Ctrl+Shift+I in Microsoft Edge also displays the interactive developer tool. With the help of this tool, users can interact with the source code and CSS options to observe how changes to the code are reflected in real-time on the web page.

Microsoft Internet Explorer:

Any of the following approaches can be used to read a web page's source code in Microsoft Internet Explorer.

How to access a web page's HTML source code

View source code only :

  1. Press Ctrl+U on the keyboard of your computer to just display the source code.
  2. From the pop-up menu, choose View Source, which displays when you right-click on an empty section of the website.

Using elements, view the page source :

  1. Go to the website whose source code you want to view in Internet Explorer.
  2. In the top-right corner, select the Internet Explorer Tools icon.
  3. The drop-down option will allow you to select F12 Developer Tools.
  4. Select the DOM Explorer tab in the top-left position on the developer tools menu.

The DOM tool can be accessed in Internet Explorer by pressing F12. With the help of this tool, users may interact with the source code and CSS options and instantly observe how changes to the code impact the web page.

Safari:

The developer options must be enabled to read a webpage's source code in Safari. You can discover how to make this feature available and then read a web page's source code in the following sections.

How to access a web page's HTML source code

How to use Safari's developer settings:

  1. First, start the Safari web browser.
  2. After that, choose Safari from the menu button in the top-left screen corner.
  3. Pick Preferences from the drop-down menu that opens.
  4. In the menu bar, select the checkbox next to Show Develop by selecting the Advanced tab.
  5. The Develop option should now be visible on the top-of-the-screen Apple menu bar.

View the page source using elements:

Method 1:

  1. To read the source code of a website, launch Safari and go there.
  2. Select Show Page Sources from the drop-down list after clicking the Develop option in the menu that appears in the bar at the very top of the screen.
  3. In the developer tools, select the Elements tab area to bring it to the center of the screen.

Method 2:

From the pop-up option that displays, choose Show Page Source by performing a right-click on an empty section of the website.

Opera:

Any of the following approaches can be used to read a web page's source code in Opera.

How to access a web page's HTML source code

View source code only :

  1. Press Ctrl+U on the keyboard of your computer to just display the source code.
  2. Select Page Source from the pop-up menu that displays when you right-click on an empty section of the website.

Using elements, view the page source :

  1. To inspect a web page's source code, open Opera and go to the desired page.
  2. Select Opera in the browser window's upper-left corner by clicking the Opera Menu button symbol.
  3. When the drop-down menu for "Developer" expands, click the "Developer tools" option with your mouse.
  4. The window will open on the right side of the screen; at the top of the window, select the Elements tab.

Select More tools Show from the developer menu if you can't see the Developer submenu. After that, click the Opera menu button again. The Developer entry ought to now appear on the list.

In Opera, the interactive developer tool can also be used by pressing Ctrl+Shift+I. With the help of this tool, users can interact with the source code and CSS options to observe how changes to the code are reflected in real-time on the web page.

Chrome is used with an Android device or tablet. :

  1. Launch the Android Google Chrome browser device you're using.
  2. View the source code of the desired web page by opening it.
  3. To advance the pointer to the beginning of the URL, tap once in the address bar.
  4. Tap Go or Enter after typing view-source.

iPhone or iPad using Safari :

It takes a little more effort, but viewing a web page's source code on an iPhone or iPad is still possible. To examine a web page's source code, you must first build a bookmark, give it JavaScript code, and then use the Bookmark on the website.

How to access a web page's HTML source code

Make a bookmark to access the source code:

  1. Open the Safari internet browser on your iPhone or iPad.
  2. Any website, such as www.javatpoint.com, can be accessed.
  3. On the screen's bottom, tap the More icon.
  4. The option opens, and then clicks Add Bookmark.
  5. Entering "View web page source code" as the new name after clearing the old one using the x on the right-hand side of the bookmark name box.
  6. To save the Bookmark, click Save in the top-right corner of the screen.
  7. Tap the bookmarks symbol at the bottom of the screen to access your bookmarks in Safari.
  8. Use the menu button at the bottom of the display to access it, locate the Bookmark you established earlier, and press and hold your finger on it.
  9. On the menu, select Edit by tapping it.
  10. Tap the URL to clear it, and then tap the x to paste the JavaScript code from Step 7 into the URL field on the Edit Bookmark screen.
  11. To save the bookmark modifications, tap Done in the bottom-right corner of the screen.

To access the source code, use a bookmark. :

The source code for a web page can now be seen after creating the Bookmark, as mentioned earlier.

  1. Open up Safari and navigate to the website where you wish to see the source code.
  2. At the bottom of the screen is a bookmarks icon. Click on it.
  3. After that, choose the Bookmark you just made to access a web page's source code.