4

Target OS: Macos 10.15.3 Catalina

Goal: use apple script bundled to app as a default web browser

To debug I'm using very simple apple script, that just show passed url in dialog

on open location theURL
    display dialog "Passed url : " & theURL
end open location

I also added CFBundleURLTypes to Info.plist to claim binding to http\https url schemas

    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLName</key>
            <string>My test app url</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>http</string>
                <string>https</string>
            </array>
        </dict>
    </array>

The problem: is that app is not showing up in 'Default web browser' combobox in System Preferences -> General

I've tried to dump Launch Service database /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump

And my app is present there.

Also tried force register /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f ./MyTestApp.app

Also tried to sign my app by self issued signature.

Nothing helped.

What could I miss? Is there any additional configurations that should be done to let macos recognize my apple scrip app as possible default browser?

  • Have you run your app ? That is, did you save it, then double-click on it the .app bundle ? – CJK Apr 7 at 0:52
  • Of course I've have run it. And as I mentioned it was registered in Launch Service database, i.e. I see my app in its dump. In other words macos is aware of my application but for some reason not allow to choose it as a default browser – Andrej Soroj Apr 7 at 9:09
1

I do not think that you can build a browser like that, but I do know that there is a very simple browser out that which will take whatever URL it is sent and pass it to the clipboard:

https://github.com/alistairmcmillan/short/tree/master/Copy%20URL%20to%20Clipboard

Perhaps that might help.

| improve this answer | |
  • I don't wanna build a browser I want an app that can be assigned as default handler for http\https url schemas. As I understand the app build from apple script is just an app as many others and I don't see any reason why it can't be a default handler for http\https. As I can judge app shouldn't be a real browser to be selected as default browser(just because I can choose evernote app, video player, or even iTerm as a default browser(i.e. default handler for http)). Looks like the matter in configuration. Therefore the question is how properly configure my app. – Andrej Soroj Apr 8 at 10:09
  • I understand what you want. What I'm saying is that I don't think it can be done the way that you want it to be done. I'd be happy to be proven wrong, but I've never seen anything that suggests that what you want can be done the way you want to do it. All of the examples that you give are…apps… not AppleScript wrappers exported as an app. – TJ Luoma Apr 11 at 17:30
0

Can’t guarantee this, but here’s what I would try:

  1. Create a .webloc on the desktop, pointing to any URI.
  2. Select it, Get Info, and change its application to your desired default. You’ll have to change “suggested apps” to “other” to be able to do it.
  3. Check the box to do it for all files of this type.
| improve this answer | |
  • It won't help since it set default application for .webloc file type not for http\https url schemas, what is originally desired – Andrej Soroj Apr 7 at 9:15

You must log in to answer this question.

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