[Update 5:30pm 8/29: I made a small change to OtherBrowser to make it less intrusive when you run it. It will no longer pop up in your dock for a second while it runs. There’s no update mechanism though. So re-download below and install as before.]
Since upgrading to Mountain Lion, and with it Safari 6, I’ve been doing my hardest to switch back to Safari as my default browser. I can’t really say why, maybe I’m just in the mood for change. Chrome is a fantastic browser. So is Safari. Safari’s UI just seems more polished, and less intrusive. I LIKE it. Anyway’s I’m trying.
I’m also trying to keep from installing Flash system wide, which means I can’t view flash on Safari. So I find myself switching between browsers a fair amount. I know other folks have offered up excellent tips, tricks, and scripts for grabbing your current page in Safari and opening it in Chrome. But none of them offered up what I wanted, which is a bookmarklet sitting in my bookmarks toolbar that I click and, shazam, the current page in the current browser is opened in the other browser. So I did some fiddling. And came up with OtherBrowser.
OtherBrowser is a VERY simple (21 lines of code) applescript application that makes it very simple to send a url to a specific browser (chrome and safari only) on your mac. The main use case here is a bookmarklet in your browser’s toolbar that will automatically send the current page to your other browser. I use this a lot when browsing on Safari I come across a site that requires flash. Hit my OtherBrowser bookmarklet (cmd–5 in safari for the fifth bookmark in the toolbar) and that site pops open in flash supporting Chrome. OtherBrowser works in the reverse direction as well (Chrome to Safari), it just requires a slight change to your bookmarklet.
OtherBrowser works by using OS X’s URL scheme support. OtherBrowser registers two new URL schemes:
Anytime you open a url on a mac with OtherBrowser installed that starts with one of those schemes (instead of, say, http://), that url gets sent to OtherBrowser instead of your Mac’s default browser. When OtherBrowser gets its hands on that URL, it sends safari url’s to safari, and chrome url’s to chrome.
I can’t imagine this not working. It’s very simple. But I’ve only tested it myself. Let’s call it a beta and all disclaimers related to it being a beta apply.
There’s more potential here. I might could build a browser extension that lets you use the OtherBrowser bookmarklet from a contextual menu. So right-click on a link and send that from Safari to Chrome. But this is a start.
You can dowload OtherBrowser here.
To install the app:
- Drag OtherBrowser somewhere on your mac. Your Applications folder is fine (as it is an application), but it’s a tiny app that you never launch directly. I keep mine in ~/Applications/.
- Right-click (or control-click) on OtherBrowser to bring up the contextual menu and select “Open” to launch it once. All this does is get you past Mountain Lion’s gatekeeper (sorry, I haven’t signed this) and to make sure OtherBrowser’s URL schemes get registered with OS X. The app will launch and immediately quit. And nothing else noticeable will happen. This is expected.
To install the bookmarklets:
- Open the text file titled “OtherBrowser Bookmarklets” in a text editor (TextEdit is fine).
- Copy the browser appropriate bookmarklet.
- Go to the browser you want to install the bookmarklet it in, create a new bookmark, paste the bookmarklet in as its address. Name it whatever. I use “toChrome” and “toSafari”
To Use: click bookmarklet when alternate browsing experience is desired…
P.S. Purely as a reference, so you know what you’re installing and how OtherBrowser works, I’ll paste in the Applescript source code below (you can also read it by showing OtherBrowser’s package contents, and checking out …/OtherBrowser.app/Contents/Resources/Scripts/main.scpt)
on open location a_URL set offs to offset of "://" in a_URL set this_URL to characters offs thru (count of a_URL) of a_URL as string set this_URL to "http" & this_URL as string set offs to offs - 1 set daScheme to characters 1 thru offs of a_URL as string if daScheme is "otherbrowser-chrome" then tell application "Google Chrome" open location this_URL activate end tell else if daScheme is "otherbrowser-safari" then tell application "Safari" open location this_URL activate end tell end if end open location