7

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?

2
  • This is a huge security vulnerability. A URL that controls the scripting of OS X is just asking to be taken over. I am not surprised that this "functionality" was "broken" in Yosemite. What exactly are you trying to accomplish?
    – Allan
    Commented Jul 6, 2015 at 19:43
  • 1
    The URL won't be "controlling the scripting of OS X." The linked script just takes the passed URL and opens it with the first browser from fixed list that is already open, and otherwise starts Chrome. If you object to it on security grounds then you might as well object to the concept of a web browser or default web browser in general.
    – dysonsfrog
    Commented Jul 6, 2015 at 23:38

2 Answers 2

2

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.

0

You can do this with Platypus by registering it as URI scheme handler for http and https.

For details see this answer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .