Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Open links in default browser by default #45

Open
jeandat opened this issue Apr 2, 2018 · 6 comments
Open

Open links in default browser by default #45

jeandat opened this issue Apr 2, 2018 · 6 comments

Comments

@jeandat
Copy link

jeandat commented Apr 2, 2018

Hi, I'm wondering, is there a way to define the behavior for links.

Indeed, I'm using nativefier for gmail/inbox and I'm a bit tired notably with a trackpad to use the second click to open links in my default browser.

The current default behavior is to open a new window inside nativefier which of course doesn't share cookies, …

Thanks :)

@pzuraq
Copy link

pzuraq commented Jun 18, 2018

The issue here seems to be that Gmail puts all links through a safe redirect, which is itself a gmail domain. Thus, links are being opened in a new tab because nativefier thinks they're "local". I was able to fix this by changing --internal-urls to something that doesn't match gmail.

@xiaogwu
Copy link

xiaogwu commented Sep 25, 2018

This worked for me:
nativefier --name "Gmail" https://mail.google.com/mail/u/0/ --icon logo_gmail_color_2x_web_512dp.png --honest --bounce --counter --internal-urls "mail.google.*?"

@omertuc
Copy link

omertuc commented Oct 21, 2019

Adding to @xiaogwu's answer:

  • The flags --name, --icon, --honest, --bounce and --counter are not required and are not relevant to this issue, only --internal-urls is relevant.

  • If you wish, you don't have to re-run nativefier, you can simply modify the internalUrls field from null to "mail.google.*?" in the resources/app/nativefier.json file inside the already-generated app directory.

  • To explain why this regex works - As @pzuraq said, all links inside gmail are actually opened via a https://www.google.com/url?q=... redirect. Since gmail is actually hosted on mail.google.com, and nativefier only compares the domain (google.com) without including the subdomain (code), the redirects itself are opened as "internal" links, @xiaogwu's regex solves this by forcing it to only consider mail.google.* as internal.

@danielmichaelni
Copy link

How would this work with messenger.com?

@mclamb
Copy link

mclamb commented Feb 25, 2020

Still having this issue even with the --internal-urls "mail.google.*?" suggestion above. Nothing seems to open with a left-click, even without any --internal-urls specified at all. Right-click open in default browser works fine. Any other ideas?

@finbarberkon
Copy link

How would this work with messenger.com?

Modify your field of resources/app/nativefier.json to the following (per @omertuc's instructions):
"internalUrls":"www.messenger.com.*"

This works because messenger redirect links are l.messenger.com/.*.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants