How to open a URL in a certain browser.

One click on this icon in my dock and Google calendar opens in Firefox from my G-mail account. This script has chosen the browser and the website and the account that I want to be logged into when I visit the website. This article below describes how to write the script to open a URL in a specified browser. To auto-login as a user see here. To customise the icon see here.

Applications are becoming more and more web-based. Rather than launch the browser and then click a bookmark it’s nice to be able to do it in one click. In OS X you can set a default browser which will open all your websites, but there is no way to set a particular website to open in a different browser.

Here is a solution using AppleScript that will allow you to do this.

I wrote this script because I like to use Chrome as my default browser for most websites, but I like to use Firefox for websites where I need to log into a particular Google account. It’s not just about launching a website with one click. I also want to choose which browser the websites open in. ( See this article for how that works).

Using this method below I can still have Chrome as my default browser but open specific websites (Gmail and Google Groups) in my Firefox browser.

  1. Firstly you need to open Script Editor. It lives in the Applications/utilities folder. Don’t be scared about using script editor if you have never used it before, it is not too hard.

2. When you first open script editor it will prompt you for what file you want to open, just click “new document”. You will be given a screen that looks like this, this is where you can enter a new AppleScript.

3. Type in the following. (or you can copy it and pasted in).

tell application “Firefox” to open location “”

This is a command telling Firefox to open a website. You can change “Firefox” to “Safari” or “Chrome”. You can change the website to be whatever you want it to be, you can just copy that from your browser.

Click on the little “hammer” icon which will check that the script does not have any mistakes in it. After you have done this it will change color so that looks like this:

If you click the “play” button it will run the script and it should open that particular website in Firefox.

When you are happy that it does what its meant to, click “save” to save your script, and then click “export” and select “application” to create an application for your script. An application means that when you click on it it will automatically run.

This will save your script as an application so that whenever you click on it it will open the website that you want , in the browser that you have chosen. You can now drag it to your dock and easily access it!

Repeat this for every website that you would like to make a shortcut to.

And don’t forget to read this article which explains how to log into Firefox from a particular Google account.

Read here for how to customise the icon.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.