How to Open Source Code in Safari Image

How to Open Source Code in Safari

Have you ever wanted to look at the actual HTML, CSS, and JavaScript code in a website? Well, there’s an easy way to do this in Safari. Instead of having to open a bunch of new tabs, you can use your mouse pointer to move on top of the page you want to inspect. In the top left corner will be an arrow next to a box which is called Inspect Element. Simply click.

Browsing open source code in Safari is great, but it takes a few extra steps. This tutorial shows you how to open code in the browser in three easy steps — without even installing any special software.

Advanced Tab Show Developer Menu Safari

How do you view HTML source code in Safari?

The first step to being able to see the HTML code of a site is to enable Develop mode, a mode that Apple hides by default as the company assumes only developers would want to tinker with these options.

How to enable Develop mode in Safari:

Step 1: With Safari opened, go to Safari > Preferences in the Menu bar.

Step 2: Go to the Advanced tab.

Step 3: At the bottom, check the box that says Show Develop menu in menu bar.

In your Menu bar, you will now see a new tab called Develop.

How to show page source code:

Now that we have enabled this developer mode, we can access the source code of a webpage in three different ways.

Option 1: On any webpage, go to Develop in the Menu bar, and select Show Page Source.

Option 2: On the webpage for which you want to see the source code, press the Option/Alt + Command + U keys simultaneously.

Option 3: This is probably the easiest option, simply make a right click on the page, and select Show Page Source.

When performing any of these actions, the source code of the page will then appear at the bottom of your Safari window. From there, you can inspect all you want.

View Source Code in Safari

Showing source code in Safari is easy:

  1. Open Safari.
  2. Navigate to the web page you would like to examine.
  3. Select the Develop menu in the top menu bar. Select the Show Page Source option to open a text window with the HTML source of the page.Alternatively, press Option+Command+U on your keyboard.The "Show Page Source" command under Safari's Develop menu
  4. If the Develop menu is not visible, go into Preferences in the Advanced section and select Show Develop menu in menu bar.

On most web pages, you can also view the source by right-clicking on the page (not on an image) and choosing Show Page Source. You must enable the Develop menu in Preferences for the option to appear.

Safari also has a keyboard shortcut for viewing the HTML source: Hold down the command and option keys and hit U (Cmd+Opt+U.)​

Advantages of Viewing Source Code

Viewing the source to see how a web designer achieved a layout will help you learn and improve your work. Over the years, many web designers and developers have learned quite a lot of HTML by merely viewing the source of web pages they see. It’s an excellent way for beginners to learn HTML and for seasoned web professionals to see how others used new techniques.

Remember that source files can be very complicated. Along with the HTML markup for a page, there will probably be significant CSS and script files used to create that site’s look and functionality, so don’t get frustrated if you can’t figure out what’s going on immediately. Viewing the HTML source is just the first step. After that, you can use tools like Chris Pederick’s Web Developer extension to look at the CSS and scripts as well as inspect specific elements of the HTML.

Is Viewing Source Code Legal?

While copying a site’s code wholesale and passing it off as your own on a website is certainly not acceptable, using that code as a springboard to learn from is actually how many people make advancements in this industry. You would be hard-pressed to find a working web professional today who has not discovered something by viewing a site’s source!

Web professionals learn from each other and often improve upon the work that they see and are inspired by, so don’t hesitate to view a site’s source code and use it as a learning tool.Was this page helpful?More from Lifewire.

How do I open an HTML file in Safari on iPhone?

Place the html file in your ~/Sites folder. Go the the URL listed in the Web Sharing panel from your iPhone, while on the home network, and open the html file. It will load in Mobile Safari.

How do I view HTML code in browser?

  1. Open your browser and navigate to the page for which you wish to view the HTML.
  2. Right-click on the page to open the right-click menu after the page finishes loading.
  3. Click the menu item that allows you to view the source.
  4. When the source page opens, you’ll see the HTML code for the full page.

How do I copy code from a website?

Chrome: Right-click a blank space on the page and choose View Page Source. Highlight the code, then copy and paste to a text file. Firefox: From the menu bar, choose Tools > Web Developer > Page Source. Highlight the code, then copy and paste to a text file.

What is my site code?

Right click your website in an area that has no text or images. You will see the View Page Source option. Click View Page Source and the code of your site will load. If you cannot right click, you can go to Tools > Web Developer > Page Source.

How to View Page Source by Keyboard Shortcut in Safari on Mac

For what it’s worth, the Chrome browser and Firefox browsers also have similar web element inspector capabilities, but obviously we’re focusing on Safari for Mac here.

Is Safari run by Google?

Safari uses Google as its default search engine out of the box, but it’s not the only option. You can choose other search engines like Bing, Yahoo, or DuckDuckGo if you prefer them. … Making the change in Safari on your iPhone or iPad is super simple, so long as you know where to look.


The new Safari browser from Apple lets you view web pages in source code view so you can see how a website is built.

Similar Posts


No Comment.