14

I have a desktop application, packaged using node-webkit. I need to open the default browser of the user on click of a link. I am using

window.open("www.google.com")

but this opens a new node-webkit window rather than opening a browser window. How do I open a browser window instead??

Infant Dev
  • 1,659
  • 8
  • 24
  • 48
  • 1
    Possible duplicate of [How to use nodejs to open default browser and navigate to a specific URL](http://stackoverflow.com/questions/8500326/how-to-use-nodejs-to-open-default-browser-and-navigate-to-a-specific-url) – Tomek Rękawek Oct 03 '13 at 11:14
  • @Tomek: Certainly looks like it, yeah; [this answer](http://stackoverflow.com/a/13419639/157247) seems most relevant. – T.J. Crowder Oct 03 '13 at 11:17
  • @Tomek, the link posted uses another gem. I would be more interested if I can play with it through any javascript method. Can't find a way to do it yet – Infant Dev Oct 04 '13 at 09:10

2 Answers2

20

To open a link in the user's default browser, you could use gui.Shell.openExternal("http://website.com"). Checkout the documentation for gui.Shell.

theabraham
  • 15,840
  • 9
  • 42
  • 41
0

NWJS Stable v0.68.0
Shell.openExternal(uri)
uri {String} A URL to open in system default manner.
Open the given external URI in the desktop’s default manner. For example, mailto: URLs in the default mail user agent.

window.nw.Shell.openExternal("https:google.com.br")

Kalmon V.
  • 1
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 17 '22 at 14:28