Open a new page on button click in html

You can't directly open a new page on a button click in HTML, as HTML is a markup language and doesn't have the capability to perform actions like opening a new page. However, you can use JavaScript to achieve this.

Here is an example of how you can do it:

HTML:

<button onclick="openNewPage()">Click me</button>

JavaScript:

function openNewPage() {
  window.open("https://www.example.com", "_blank");
}

In this example, when the button is clicked, the openNewPage() function is called, which uses the window.open() method to open a new page at the specified URL (https://www.example.com) in a new tab (_blank).

You can also use the location.href property to open a new page:

function openNewPage() {
  location.href = "https://www.example.com";
}

This will open the new page in the same tab.

You can also use the window.location.replace() method to open a new page:

function openNewPage() {
  window.location.replace("https://www.example.com");
}

This will replace the current page with the new page.

Note: The window.open() method can be blocked by the browser's popup blocker, so you may need to add some additional code to bypass this.

Also, you can use the target attribute on the a tag to open a new page:

<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Click me</a>

This will open the new page in a new tab.

You can also use the href attribute on the button tag to open a new page:

<button href="https://www.example.com">Click me</button>

This will open the new page in the same tab.

Please note that the above examples are just a demonstration and you should adjust the URL and the method according to your needs.