简体   繁体   中英

How to open a browser window from a node-webkit app?

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

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 .

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM