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??

3

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks.. It works perfect. This also comes in the window object, so I can say window.gui.Shell.openExternal("website.com")
is there a way to store a reference to the window that is opened?
For completeness, you must define before the gui variable: var gui = require('nw.gui');
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")

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.