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

Open external links in new window instead of default browser #212

Closed
felipemeamaral opened this issue Jun 2, 2016 · 15 comments
Closed

Open external links in new window instead of default browser #212

felipemeamaral opened this issue Jun 2, 2016 · 15 comments

Comments

@felipemeamaral
Copy link

I know some people could think it will not reproduce the same feeling as using a native app, but in my case I want it to:

  • open external links on another window or tab

'Cause I want to isolate these links from browser.

Anyone succeeded on achieve this?

Tried the process explained there: electron/electron#2843 but with no luck.

@stewhouston
Copy link

+1

I like the functionality provided by right clicking a link, then clicking "Open in a new window" in the subsequent context menu. I'm not sure how one might go about producing this programmatically.

@jiahaog
Copy link
Member

jiahaog commented Jun 12, 2016

It would be possible to spawn a new BrowserWindow, for another url. Currently, nativefier only creates a single window for the target url. Implementing multiple windows could take quite some work though. It would be cool if we could have a flag for this!

@matthewdias
Copy link
Contributor

matthewdias commented Jul 22, 2016

This already works by shift-clicking a link. Could be enhanced tho by adding a menu item so you could open a new window with the base URL.

edit: i forgot this already exists.

@tmikaeld
Copy link

Would really want this to be an option for compilation, to be able to choose the default behavior of external links.

@zeke
Copy link

zeke commented Sep 21, 2016

Would really want this to be an option for compilation, to be able to choose the default behavior of external links.

Yes! That way everyone gets the behavior they want without breaking changes.

@ronjouch
Copy link
Contributor

ronjouch commented Apr 8, 2017

"Would really want this to be an option for compilation, to be able to choose the default behavior of external links"

Hey @tmikaeld @pulgalipe @zeke, would Nativefier 7.1.0's new --internal-urls option (see code at #230) work for your use cases? Documentation says:

--internal-urls <value>:  regular expression of URLs to consider "internal"; 
                          all other URLs will be opened in an external browser.
                          (default: URLs on same second-level domain as app)
  • Set it to a gibberish regex that will never match, and no link will be considered 'internal', forcing opening in browser
  • Set it to a match-all regex like .*, and all links should be considered 'internal', forcing in-app navigation.

Also, for an exact opposite take: #23

@ronjouch ronjouch changed the title Open external link in new window or tab instead default browser Open external links in new window instead of default browser Apr 8, 2017
@zeke
Copy link

zeke commented May 3, 2017

Thanks, @ronjouch! I will give --internal-urls a try.

@7ammer
Copy link

7ammer commented Aug 17, 2017

FYI .. @ronjouch comment about --internal-urls .* works well for my oAuth popup issues 👍

@ronjouch
Copy link
Contributor

ronjouch commented Aug 17, 2017

FYI .. @ronjouch comment about --internal-urls .* works well for my oAuth popup issues 👍

@7ammer cool! Just curious: which oAuth popup issues?

@7ammer
Copy link

7ammer commented Aug 18, 2017

@ronjouch trying to run this: https://github.com/jaedb/Iris within nativefier worked brilliantly. However, when I needed to authenticate myself as a user I had issues with it complaining that popups were blocked. --internal-urls .* seemed to alleviate this issue and enabled popups to work again.

@zeke
Copy link

zeke commented Aug 18, 2017

The internal-urls technique worked for me. Wrote about it here: http://zeke.sikelianos.com/electron-nativefier/

@plainspace
Copy link

This isn't working for me. What am I missing?

nativefier --name "Inbox" "https://inbox.google.com/" --internal-urls .*

packaging [==============================                    ] 61%Packaging app for platform darwin x64 using electron v1.6.6
{ Error: ENOENT: no such file or directory, rename '/Users/darwin-x64-template' -> '../Inbox-darwin-x64'
    at Error (native)
  errno: -2,
  code: 'ENOENT',
  syscall: 'rename',
  path: '/Users/darwin-x64-template',
  dest: '../Inbox-darwin-x64' }
  packaging [========================================          ] 80%

PS I am able build without --internal-urls .*

@plainspace
Copy link

🐥

I just fixed this. Thanks for the write up @zeke!

nativefier \
--name "Inbox" \
--internal-urls "xxxxxxxxx" \
https://inbox.google.com/

@sameerHub
Copy link

nativefier google auth works with internal urls.

internal url command : --internal-urls

"(.?)(accounts.google.com)(.?)"

nativefier --name "" --flash --width "700" --height "500
" "<your.domain.com>" --internal-urls "(.?)(accounts.google.com)(.?)"

@CuiYongen
Copy link

This already works by shift-clicking a link. Could be enhanced tho by adding a menu item so you could open a new window with the base URL.

edit: i forgot this already exists.

its really a perfect solution! also works for chrome which i didn't know before

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

No branches or pull requests