简体   繁体   中英

Open url in default OS browser using JavaScript

Is there a way to open URL in default OS browser using JavaScript?
I have button and want to open certain URL whenever user clicks on this button.

window.open('https://example.com', '_blank');

I assume you were looking for a browser solution. Not the OS' default browser but the one you are currntly using this from. Using the OS's default browser is not possible from the browser itself but possible if you were in a dedicated runtime like NodeJS.

If you are looking for the latter one, check out this post on SO: How to use nodejs to open default browser and navigate to a specific URL

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