-1

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.

  • 4
    Where is this JavaScript being executed? – Dai Oct 06 '20 at 06:35
  • i'm using in .asp page – Sudhakar Boyini Oct 06 '20 at 06:44
  • Does this answer your question? [How to open a link in chrome browser, even though the default computer browser is 'Safari'?](https://stackoverflow.com/questions/26918255/how-to-open-a-link-in-chrome-browser-even-though-the-default-computer-browser-i) – Joona Yoon Oct 06 '20 at 06:47

1 Answers1

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

Num Lock
  • 742
  • 1
  • 6
  • 32