How to Open Link in New Window by using Javascript ?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in this blog, I will show you how to open the link in new window by using javascript. Here I would like to take the current page URL and then want open it in a new window.

Now here I will give you a simple and very easy example for open link in new window by using javascipt is in bellow. So you can see the simple example of open url in new window by using window.open() by using javascript.

Syntax :

window.open(URL, name, specs, replace);

Use :

window.open("https://www.codingspoint.com/","mywindow","status=1,toolbar=1");

Example

<!DOCTYPE html>
<html>
<head>
    <title>javascript open link in new window example - codingspoint.com</title>
</head>
<body>
    
    <h1>codingspoint.com</h1>

    <button onclick="getLink();">Click me</button>

    <script type="text/javascript">
        function getLink() {
            window.open("https://www.codingspoint.com/","mywindow","status=1,toolbar=1");
        }
    </script>
</body>
</html>

Read Also : How to Image Validation in Laravel ?

Thank you read.Hope it will help you. Also follow onĀ facebook

About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →