QA Graphic

Displaying the Browser URL

Using AppleScript it's easy to display the Browser URL from any app.

The ability to run AppleScript from TextExpander is win win situation. Here's another cool snippet using AppleScript that I think you'll enjoy:

Let's say that I find a great article on that mentions the company that I use to work at. I decide to share some of the content to a former co-worker. So, I cut and paste the relevant text from the browser and compose a new email message with that text. Now if I want to include the URL, I would have to go back to the browser and copy the URL and then paste it in the email.

With TextExpander and some very basic AppleScript I don't have to go back anymore! I created a snippet to get the URL of the browser. Since I have multiple browsers on my computer I have a couple of snippet setup.

TextExpander URL

Here's a sample code for Chrome, don't forget to set the Content to AppleScript:

tell application "Google Chrome"
 set theURL to URL of active tab of window 1
end tell

The abbreviation that I assigned the task is very easy to remember: chrome.url and safari.url

Now where ever I want to share the URL of the page I am looking at, I just need to remember what browser I used.

What about Firefox?

Apparently Firefox removed the ability to use AppleScript in the latest version due to some technical reasons.

You can read all about the latest Apple/Firefox drama in Bug 516502 "Re-add AppleScript support for getting the current URL" bug report.



Add Comments




I find TextExpander, by Smile on My Mac, to be an awesome productivity tool. This past winter, I posted some cool snippets that demonstrate the power of the application. Occasionally, I will post some new snippets that I think will be useful in anyone's TextExpander library.


SaturdayInternet Tools
SundayOpen Topic
Monday Media Monday
WednesdaySnagIt for QA