MacOS – How to register AppleScript as default web browser in Yosemite

applescriptmacos

This is essentially the same question as How to register an AppleScript as a potential default web browser?, but the solution there doesn't seem to work on Yosemite (LSIsAppleDefaultForScheme no longer exists).

I've written an AppleScript, saved as an application, and checked "Stay Open." I've also added a CFBundleURLTypes entry to the Info.plist with http and https and identifier "Web site URL," mimicking entries in other browsers' plists. I think basically the same procedure worked when I last tried on Mavericks.

Nevertheless, LaunchServices doesn't seem to be picking up the applet as a possible default web browser. I've already tried rebuilding the LaunchServices DB and opening and quitting the applet a few times.

Anybody else tried to do this recently?

Best Answer

My experience is that you can no longer define an AppleScript applet as the default handler upfront by the Info.plist. And, if you try, by including LSIsAppleDefaultForScheme in your Info.plist, that applet will no longer even be allowed as a handler for the URL type at all. After upgrading to Yosemite, my applet would no longer be called when I clicked a link using my custom protocol. I instead got the not-handled system error when clicking the link. Once I removed LSIsAppleDefaultForScheme, it began to work again.

It seems perhaps more difficult to get Mac OS X to recognize alternate handlers for http and https. When I tried setting my Info.plist for those, the applet failed to show as an option for "Default web browser" in the General system preference pane. However, the third-party preference panel RCDefaultApp was able to see and set my applet as the handler for the http protocol by using its URLs section, and that seemed to work. However, even that was a bit odd: if the applet wasn't open but a different applet with a different BundleID was open, the first time I click an http link brought that other applet to the front, rather than launching the correct one.

So, long story short: I'm not sure I have a perfect solution for this, but perhaps RCDefaultApp will help you get it working in a way that works for you.