New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
felipemeamaral opened this Issue Jun 2, 2016 · 13 comments

Comments

Projects
None yet
9 participants
@felipemeamaral

felipemeamaral commented Jun 2, 2016

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

This comment has been minimized.

Show comment
Hide comment
@stewhouston

stewhouston Jun 8, 2016

+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.

stewhouston commented Jun 8, 2016

+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

This comment has been minimized.

Show comment
Hide comment
@jiahaog

jiahaog Jun 12, 2016

Owner

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!

Owner

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

This comment has been minimized.

Show comment
Hide comment
@matthewdias

matthewdias Jul 22, 2016

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@tmikaeld

tmikaeld Sep 20, 2016

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

tmikaeld commented Sep 20, 2016

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

@zeke

This comment has been minimized.

Show comment
Hide comment
@zeke

zeke 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.

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

This comment has been minimized.

Show comment
Hide comment
@ronjouch

ronjouch Apr 8, 2017

Collaborator

"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

Collaborator

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 from Open external link in new window or tab instead default browser to Open external links in new window instead of default browser Apr 8, 2017

@ronjouch ronjouch removed the need info label Apr 21, 2017

@zeke

This comment has been minimized.

Show comment
Hide comment
@zeke

zeke May 3, 2017

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

zeke commented May 3, 2017

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

@7ammer

This comment has been minimized.

Show comment
Hide comment
@7ammer

7ammer Aug 17, 2017

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

7ammer commented Aug 17, 2017

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

@ronjouch

This comment has been minimized.

Show comment
Hide comment
@ronjouch

ronjouch Aug 17, 2017

Collaborator

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

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

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@7ammer

7ammer 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.

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

This comment has been minimized.

Show comment
Hide comment
@zeke

zeke Aug 18, 2017

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

zeke commented Aug 18, 2017

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

@plainspace

This comment has been minimized.

Show comment
Hide comment
@plainspace

plainspace Sep 5, 2017

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 commented Sep 5, 2017

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

This comment has been minimized.

Show comment
Hide comment
@plainspace

plainspace Sep 5, 2017

🐥

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

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

plainspace commented Sep 5, 2017

🐥

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

nativefier \
--name "Inbox" \
--internal-urls "xxxxxxxxx" \
https://inbox.google.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment