UncleCoder.com

UncleCoder.com

Free programming examples and instructions

Javascript - Open Url in new tab

demo and code for how to open url in new tab in javascript

by Athil


Posted on 03 Feb 2020 Category: Javascript Views: 226


 

Here Iam going to show how to open a Url in new tab in Javascript.

DEMO

To open in new URL from javascript

  window.open('url');

 

Demo full Code

HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Unclecoder.com || Javascript example open url in new tab</title>
</head>
<body>
    <h1>
        Demo for Open url in new tab in javascript.
        </h1>

    <button onclick="opennewtab()"> Click here to open in new tab  </button>

</body>
</html>

Javascript

 function opennewtab()
 {

      window.open('https://unclecoder.com')
 }

 

Related articles

Redirect URL - Javascript

 

 



Leave a Comment: