How to View Source Code

This minHour teaches you how to view the source code of a website, which is the code behind any website (such as HTML, CSS, and JavaScript), on most common browsers. Excluding a Safari trick, you cannot view a website's source code while using a mobile browser.

Chrome, Firefox, Edge, and Internet Explorer

Open your web browser.

The process for viewing source code on Chrome, Firefox, Microsoft Edge, and Internet Explorer is the same.

Navigate to a webpage.

It should be a page whose source code you wish to view.

Right-click the page.

If you’re using a Mac computer with a one-button mouse, you can hold down Control and click instead. If you are on a laptop with a trackpad, you can use two fingers to click the page instead. This will invoke a drop-down menu.

  • Don’t right-click a link or a photo when doing this or else the wrong menu will appear.

Click View page source or View Source.

Doing so will display your browser’s source code in a new window or at the bottom of the current window.

  • You’ll see View page source for Chrome and Firefox, and View Source for Microsoft Edge and Internet Explorer.
  • You can also press (PC) or (Mac) to display the source code.

Safari

Open Safari.

This is a blue, compass-shaped app.

Click Safari.

It’s in the top-left side of your Mac’s menu bar. Doing so invokes a drop-down menu.

Click Preferences.

This option is in the middle of the drop-down menu.

Click the Advanced tab.

It’s in the top-right corner of the Preferences window.

Check the “Show Develop menu in menu bar” box.

This option is near the bottom of the Preferences window. You should see a menu appear in your Mac’s menu bar.

Navigate to a webpage.

It should be a page whose source code you wish to view.

Click Develop.

This menu is to the left of the menu in your Mac’s menu bar.

Click Show Page Source.

It’s near the bottom of the drop-down menu. Clicking this option will prompt Safari to display the webpage’s source code.

  • You can also press to display the source code.

On Wikis

Navigate to the page you want to view the wiki source code for.

Click on the “View source” or “Edit” tab.

Scroll through the source and select/copy the code you want to copy on your site.

Tips

  • While you can’t usually view source code on a mobile browser, you can save a Safari bookmark on iPhone or iPad to view mobile Safari source code.

Warnings

  • Be wary of downloading third-party applications that claim to display the source code of a website.

Leave a Comment