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")
but this opens a new node-webkit window rather than opening a browser window. How do I open a browser window instead??
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??
Share Improve this question asked Oct 3, 2013 at 11:10 Infant DevInfant Dev 1,7499 gold badges24 silver badges48 bronze badges 3- 1 Possible duplicate of How to use nodejs to open default browser and navigate to a specific URL – Tomek Rękawek Commented Oct 3, 2013 at 11:14
- @Tomek: Certainly looks like it, yeah; this answer seems most relevant. – T.J. Crowder Commented Oct 3, 2013 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 Commented Oct 4, 2013 at 9:10
2 Answers
Reset to default 20To open a link in the user's default browser, you could use gui.Shell.openExternal("http://website.com")
. Checkout the documentation for gui.Shell.
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")