Next-Gen App & Browser
Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

How to View Source Code in Safari?

To view the source code of a webpage in Safari on a Mac, follow these steps:

On Mac:

  • Open Safari and navigate to the webpage whose source code you want to view.
    • Enable the Develop menu if it’s not already visible:
    • Go to Safari > Preferences in the top menu.
    • Click the Advanced tab.
    • Check the box labeled Show Develop menu in menu bar.
  • Once the Develop menu is enabled, you can:
    • Select Develop > Show Page Source from the menu bar.
    • Or use the keyboard shortcut Option + Command + U.
  • The HTML source code will appear in a new window or pane for you to inspect.

You can also right-click on the page and select Show Page Source if the Develop menu is enabled.

On iPhone or iPad:

Safari on iOS does not have a built-in source code viewer, but you can use these alternatives:

  • Third-party apps: Download an app like "View Source" or "Source for Webpage" from the App Store. Use the Share icon in Safari to send the page to the app and view its source code.
  • Bookmarklet method: Create a bookmark in Safari and replace its URL with this JavaScript code:
  • javascript:(function(){window.location='view-source:'+location.href})()
    

    When you tap this bookmarklet on any page, it will display the source code.

Tips:

  • For deeper inspection (including CSS and JavaScript), use Develop > Show Web Inspector.
  • You can also right-click on specific elements and choose Inspect Element to focus on particular parts of the page.

Read More Software Testing Questions

Test Your Website on 3000+ Browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...
ShadowLT Logo

Start your journey with LambdaTest

Get 100 minutes of automation test minutes FREE!!

Signup for free