will-stone / browserosaurus

🦖 The browser prompter for macOS
https://browserosaurus.com
GNU General Public License v3.0
1.71k stars 161 forks source link

Browserosaurus does not show when opening downloaded html file #564

Open aaronkollasch opened 2 years ago

aaronkollasch commented 2 years ago

Is there an existing issue for this?

Current Behaviour

When opening a downloaded html file, Browserosaurus grabs focus but no window appears.

Expected Behaviour

Browserosaurus shows the browser picker, a prompt to approve opening the file, or some error message stating that the file could not be opened.

Steps To Reproduce

  1. Download an html file from the web, e.g. https://example.com/index.html
  2. Right-click the file -> Open With -> Browserosaurus (or double-click if Browserosaurus is the default app for opening html files)

Browserosaurus version

19.0.0

macOS version

12.5

CPU Architecture

ARM

Anything else?

The downloaded file has the com.apple.quarantine attribute, and removing it with xattr -d com.apple.quarantine index.html allows the browser picker to appear as expected.

will-stone commented 2 years ago

Thanks. I've not heard of com.apple.quarantine, I'll have to do some reading up on that.

will-stone commented 2 years ago

I don't really know the solution here as Browserosaurus cannot see the incoming URL (file) 🤷‍♂️

mreid-tt commented 1 year ago

I don't really know the solution here as Browserosaurus cannot see the incoming URL (file) 🤷‍♂️

Hmm, I'm sure there must be a way to handle this since other apps can open the file directly. Consider these command prompt examples:

% open -a "Brave Browser" index.html
% open -a "Safari" index.html

But if we use 'B', it fails if you use the command:

% open -a "Browserosaurus" index.html

So I'm thinking there must be some way for 'B' to be configured to accept input using the standard MacOS open command (from /usr/bin/open).

EDIT: Perhaps it's just a different input type for 'file' versus 'URL' that 'B' needs to be enabled to parse and then pass onto a specific browser using a similar open command?

will-stone commented 2 months ago

This should now be fixed in v20.9.1 but let me know if you still have issues with it.

mreid-tt commented 2 months ago

This should now be fixed in v20.9.1 but let me know if you still have issues with it.

I've just upgraded and I don't see any changed behaviour based on the original steps to reproduce. I'm running Sonoma 14.6.1 with B 20.9.1.

will-stone commented 2 months ago

Strange, seems to be okay for me. Your command works with B too.

mreid-tt commented 2 months ago

Strange, seems to be okay for me. Your command works with B too.

Strange indeed. Neither works for me...

https://github.com/user-attachments/assets/c3360b9f-07fa-49df-adea-c2a019b323ae

will-stone commented 2 months ago

You're right; just tried it on my work machine and it still doesn't work. Boo 😭

AlexStrNik commented 2 weeks ago

Add this to your Info.plist, should work afterwards

<key>CFBundleDocumentTypes</key>
<array>
  <dict>
      <key>CFBundleTypeIconSystemGenerated</key>
      <integer>1</integer>
      <key>CFBundleTypeName</key>
      <string>HTML document</string>
      <key>CFBundleTypeRole</key>
      <string>Viewer</string>
      <key>LSHandlerRank</key>
      <string>Default</string>
      <key>LSItemContentTypes</key>
      <array>
          <string>public.html</string>
      </array>
  </dict>
  <dict>
      <key>CFBundleTypeIconSystemGenerated</key>
      <integer>1</integer>
      <key>CFBundleTypeName</key>
      <string>XHTML document</string>
      <key>CFBundleTypeRole</key>
      <string>Viewer</string>
      <key>LSHandlerRank</key>
      <string>Default</string>
      <key>LSItemContentTypes</key>
      <array>
          <string>public.xhtml</string>
      </array>
  </dict>
</array>
will-stone commented 2 weeks ago

@AlexStrNik thanks. Could you please test and PR that? I can see it says “public.html”. Is that a special string? Otherwise won’t it only work for files called “public”?

AlexStrNik commented 6 days ago

I'm sorry, maybe next week I will have more free time. "public.html" is a special string, I'm not sure why it is like this, but it works for me.