Bug 347870 - Default Applications > Web Browser "in an application based on the contents of the URL" is confusing and undocumented
Summary: Default Applications > Web Browser "in an application based on the contents o...
Status: RESOLVED DUPLICATE of bug 100016
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_componentchooser (show other bugs)
Version: 5.3.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-18 00:02 UTC by skierpage
Modified: 2018-12-23 04:14 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description skierpage 2015-05-18 00:02:04 UTC
Years ago I set up KDE to use SeaMonkey as my browser. Now I'm trying to change to Firefox. In System Settings > Default Applications > Web Browser > Default Component,  "Open http and https URLs" is set to "in an application based on the contents of the URL". What does this mean? What should I do now? There's no "URL" or "contents" item in Default Applications or in System Settings! Is this actually referring to File Associations? I have no idea.

The Shift-F1 context-sensitive help explains "component program... You can choose here which programs these components are." but that's a generic explanation for the entire Default component. I'm not provided any explanation of what to do next. And Help > System Settings Handbook is no more informative.

Reproducible: Always

Steps to Reproduce:
1. Visit System Settings > Default Applications > Web Browser
2. Stare blankly at "in an application based on the contents of the URL"


Expected Results:  
Be clearer what the I'm supposed to do by some combination of
* Ideally linking the words "based on the contents of the URL" to where I set this
* telling me where to go to set this
* or using terms that actually show up somewhere in Default Applications or System Settings.
* having term-specific Shift-F1 help.

Also explain this in the System Settings manual, and tell me where this information is stored. Is it
   BrowserApplication[$e]=myseamonkey.desktop
in ~/.kde/share/config/kdeglobals? Is it something in ~/config/mimeapps.lst Is it ~/.local/share/applications?

I'm running Kubuntu 15.04 and followed some instruction to run newer Plasma packages.
Comment 1 skierpage 2015-05-18 01:23:31 UTC
Here's what I did.

First you need a menu item for your preferred browser. If that browser already appears in the (K) application launcher > Applications > Internet menu then you're set, otherwise you need to create it with (K) application launcher > Right-click Applications > Edit Applications... and then follow the only-somewhat out-of-date instructions in https://docs.kde.org/stable5/en/kde-workspace/kmenuedit/quickstart.html , dodging issues like Bug 346316. This will create a ~/.local/share/applications/MyPreferredBrowserName.desktop file.  You probably want to copy many of the config lines over from a similar browser .desktop file shipped by your distribution, e.g. /usr/share/app-install/desktop/firefox:firefox.desktop

Now, go into System Settings > Applications > Default Applications > Web Browser and choose 'in the following browser" and choose Known Applications > Internet > your preferred browser. I think this will set 
  [General]
  BrowserApplication[$e]=MyPreferredBrowserName.desktop
in ~/.kde/share/config/kdeglobals

You can always/as well/instead? go into System Settings > Applications > File Associations, search for html, png, etc. and for each one in the Application Preference Order click [+ Add...] and add Known Applications > Internet > your preferred browser. I think this will update a line in ~/.local/share/applications/mimeapps.list for that mime type. (The annoying thing here is that any decent browser supports a dozen or more mime types ( text, xml, rdf, svg, png, jpg) and URI schemes beyond just "Web pages, but it's so fiddly to make it the default for them all.)

I still don't know whether to choose "in an application based on the contents of the URL" or "in the following browser".
Comment 2 Martin van Es 2015-11-04 13:26:48 UTC
It's even worse: This option wreaks havoc on links that contain personalised tokens and generate an immediate redirect to the personalised content since it opens the preferred browser based on the URL in the location header of the original URL's response. If this URL contains a session identifier, the browser fails to pick-up the correct session, as can be seen in bug #354822 I filed some hours ago.
Comment 3 Martin van Es 2017-10-31 15:25:30 UTC
I just hit my head again against the problem reported in comment https://bugs.kde.org/show_bug.cgi?id=347870#c2
Please remove content inspection option from default browser, it's broken by design!
Comment 4 Nate Graham 2018-11-26 05:53:05 UTC

*** This bug has been marked as a duplicate of bug 100016 ***
Comment 5 Nate Graham 2018-12-23 04:14:26 UTC
Git commit 7bd7f38400b953a988a2cc942a518339e0b094a8 by Nate Graham.
Committed on 23/12/2018 at 04:14.
Pushed by ngraham into branch 'master'.

[KRun] when asked to open link in external browser, fall back to mimeapps.list if nothing is set in kdeglobals

Summary:
Right now, when KRun is invoked to open an `http` or `https` link in a browser, it checks the `BrowserApplication` key in `~/.config/kdeglobals`. If nothing is set there (which is the default), then it introspects the link and figures out for itself what app to open, which is slow and can cause problems with certain links (see CCBUGs below).

This patch improves the browser discovery logic by additionally looking for a default browser in `~/.config/mimeapps.list`, which is the XDG file and it's where browsers set themselves as the default. So if there is a default browser set in there, KRun will consume that information immediately instead of doing the time-consuming and possibly error-inducing link introspection round-trip.
Related: bug 100016

Test Plan:
1. Open System Settings > Applications > Default Applications > Browser and click "In an application based on the contents of the url" (which is the default setting, but you might have changed it)
2. Set `BrowserApplication[$e]=` in `~/.config/kdeglobals`
3. Ensure that `~/.config/mimeapps/list` has a default browser set
4. Open any KDE app > Help menu > About KDE > Click on one of the links in the dialog

Without this patch, a KRun job is spawned that shows up in the notification widget and the link may take a second or two to open in your default browser.

With this patch, the link instantly opens in the browser.

Reviewers: #frameworks, broulik, cfeck, elvisangelaccio, dfaure

Reviewed By: dfaure

Subscribers: dfaure, rdieter, achauvel, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D17371

M  +13   -0    src/widgets/krun.cpp

https://commits.kde.org/kio/7bd7f38400b953a988a2cc942a518339e0b094a8