As a web developer, I am constantly switching back and forth between different web browsers. Sometimes this is due to necessary cross-browser testing of my code, but often times I find myself switching out of Chrome and into Firefox or Safari simply because a page doesn’t load correctly.
In situations like that where I am forced to open another, different browser, simply to view one single page, well, it’s bit of a process to go to the URL bar, copy the URL, open Firefox, paste, wait, and then, 3 or 4 steps later, I’m finally viewing my page. For those of us who like to optimize everything we do, that is simple just too many steps for too little a reward.
I had a little extra time this afternoon, so I thought I’d whip up some AppleScripts to take care of this problem for us! (I have been meaning to write these for a while now, actually XP). The following scripts (which are all also available as gists over at my GitHub account!) are relatively simple by themselves, but when combined with a dedicated keyboard shortcut (I use Alfred.app’s Hotkeys, myself), they become very helpful indeed.
These first two scripts, shown below, automate the process of opening your current tab in a new browser by first grabbing the URL of Chrome’s current tab, then by launching Firefox (or Safari) and loading our target URL in that browser.
The other two scripts I wrote this afternoon, shown below, have more of a direct purpose: duplicating the browser’s current tab. I have scripts for both Chrome and Firefox here, and I imagine Safari wouldn’t be much different from these.
I hope you find these scripts useful and productive in some way! Again, you can download all of these scripts directly from my GitHub Gists account. While I focused on the Google Chrome browser in these scripts (my browser of choice), it shouldn’t be that hard to adapt this code for use with other browsers. If you feel so inclined, please leave me a comment here, or fork my code on GitHub! AppleScripts have a very broad scope, and they have a surprisingly low learning-curve, so there are literally endless opportunities for automation and optimization here! ^_^ (Haha, if it wasn’t already obvious, optimization and automation are exciting topics to me!)
Have a great day everybody! Safe travels!