Keyboard shortcut for opening current Safari page in Google Chrome

Jun 12, '12 07:30:00AM

Contributed by: sven

Assigning a shortcut to open Safari's current page in Google is simple but breaks frequently, because the menu item name includes Chrome's version number. The simple fix is to use an Apple Script like Mike Hardy's as a proxy to Google Chrome. I'm describing this in more detail in this blog post, which is also reproduced below.

Currently shipping Macs come without Adobe Flash Player preinstalled, and I’ve been running that same setup without Flash for quite a while now myself. More and more webpages work fine without Flash and only the occasional video requires it. When that is the case, I simply go to the Develop menu (enable it in Safari's Advanced preferences if you don’t have it) and select Open Page With > Google Chrome.app (20.0.1132.21). Since Google Chrome comes with Flash preinstalled, this is a simple way to switch to a Flash-enabled browser.

Now, rather than choosing Chrome from the menu it would be nice to assign a keyboard shortcut for this menu item, and this is actually quite simple: Open the keyboard preference pane in System Preferences, select ‘Application Shortcuts’ and add a shortcut for the Google Chrome.app (20.0.1132.21) menu item to Safari. However, the problem here is that the menu item contains the version number of Chrome and since Chrome updates frequently (and in the background), you’ll find yourself with a broken shortcut very soon.

The fix for this is a little Apple Script OpenURLInNewChromeWindow.app by Mike Hardy which tells Google Chrome to open the URL via an Apple Script command. If you run this script once, it will register itself as a application that can handle URLs, and will therefore also appear in the list of browsers under Open Page With. Opening a page with this script will open the current page in Chrome just like before, but the menu item will stay the same no matter which version of Chrome you have installed. You simply assign the shortcut to this "browser" instead of the ever-changing Chrome.

As an added benefit (and actually the reason Mike Hardy wrote the script in the first place) is that the page opens in a new window and not in a new tab (which can be quite annoying when using virtual screens). See Mike’s blog post for more details how to use his script in that context.

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20120605144727630