Jump to content

Custom Websearch does not apply params to local files accessed via "file://"


Gruni

Recommended Posts

I tried to add a custom web search for a locally stored copy of the Godot Documentation (https://docs.godotengine.org/en/stable/ - Scroll down to Offline Documentation and download Stable, then open index.html)

It offers a very simple but useful javascript based search that works locally: file:///Users/gruni/Downloads/godot-docs-html-stable/search.html?q={query}&check_keywords=yes&area=default# with + (plus) as space character. The search does not only work when triggered from the input field - but also when opening the file directly with these parameters, so I thought great: I'll create a custom websearch for it and can save some time. 

However, when actually triggering the search with one or multiple keywords, Alfred only opens the web browser straight to file:///Users/gruni/Downloads/godot-docs-html-stable/search.html without any additional parameters - unlike with any other one of my custom web searches set up using the http(s) protocol.

So I assume it's a problem directly tied to using file:// with Alfred itself.

Replicable with Alfred 5.5 (2257) on macOS 14.5-7 and 15.0 regardless of the web browser (tested with Firefox, Safari, Edge, Opera and Orion set as default browser, just in case)

Screenshot 2024-09-21 at 09.58.00.png

Screenshot 2024-09-21 at 10.00.10.png

Link to comment

Welcome @Gruni,

 

6 hours ago, Gruni said:

So I assume it's a problem directly tied to using file:// with Alfred itself.

 

Not exactly. Here’s something else you can try: open a terminal and run open 'file:///Users/gruni/Downloads/godot-docs-html-stable/search.html?q=3d+gizmo&check_keywords=yes&area=default'. You’ll note you’ll get the same behaviour as in Alfred.


When you ask Alfred to open a URL, Alfred just asks macOS (note it’s the operating system, not any specific browser) to open the URL. At this point it’s out of Alfred’s hands. macOS then asks the default app that handles those URLs to open it. At this point it’s out of macOS’ hands. Then the app does it. But the app set to open file:// URLs is the Finder, not a web browser, and the Finder naturally ignores those parameters.


So what you have to do is tell a specific web browser to open that URL. But every web browser needs different commands (and Firefox can’t do it) so that has to be taken into account as well.


Here’s a workflow for that.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...