In Windows there is an option to allow you create an index.html file which opens a specific web address when clicked on it. How can I create a similar file in Mac?

I want to have a file called index.html and when clicked, a web address www.example.com should open in the default browser.

  • A single-click just chooses/marks a file but doesn't open/launch anything in the Finder! You either have to drag the file on the Dock (and click on it there to open it) or use some 3rd-party tools.
    – klanomath
    Commented Apr 20, 2017 at 7:01

2 Answers 2


If you are determined to use an HTML file, you can create one with a text editor (e.g. the built-in TextEdit; make sure you use the Plain Text view rather than the Rich Text which is the default).

Your HTML file should contain a so-called meta-refresh tag for this:

<meta http-equiv="refresh" content="0; url=http://www.example.com/" />

The page will automatically redirect upon loading.

Alternatively, because this sounds like an XY-problem: create a shortcut to the page on your Desktop, as described by Joonas.


Drag favicon from a browser to the desktop or into Finder.

This creates a .webloc file, which will open in the default browser when opened.

In some sites you may have to drag the lock icon, info icon... or whatever is on the immediate left from the site url in the address bar. You may also try selecting the url and dragging that, but that doesn't work in Chrome at least, I believe.

Works in Safari, Chrome and Firefox

I should also mention that you should be able to do this with any link elements in a website as well. It may not work if javascript is used load things when the link is clicked.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .