Ways To Open URL In New Window

In this article, I will explain the ways to open an URL in a new Window. So let’s start the tutorial.

Ways To Open URL In New Window

There are 3 ways, to use them we can open the URL in a new Window.

  1. Using Method
  2. Using Anchor Tag
  3. Using input tag

let’s start one by one.

1. Using Method

This method is used to open a new browser window or tab based on the browser setting and provided parameters.

Syntax:, name, specs, replace)

All the parameters from the above syntax are optional. But If you want to open an URL then pass the URL of the page into the URL parameter. Check the below example with your console."");

2. Using Anchor Tag

Using the <a> tag we can open an URL in a new window. Check the below code.

<a href="">The Code Hubs</a>

3. Using input Tag

Using input tag and method, we can open an URL into another tab. See the below example.

<input type="button" value="button name" onclick="'')" />

Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories