Html button open in new tab

To make an HTML button open in a new tab, you can use the target attribute and set its value to _blank. Here's an example:

<button type="button" target="_blank" href="https://www.example.com">Open in new tab</button>

This will open the link in a new tab when the button is clicked.

Alternatively, you can use the onclick attribute to achieve the same result:

<button type="button" onclick="window.open('https://www.example.com', '_blank')">Open in new tab</button>

This will also open the link in a new tab when the button is clicked.

Note that the target attribute only works if the href attribute is present. If you want to open a new tab without linking to a specific URL, you can use the onclick attribute instead.

Also, you can use the rel attribute to specify the relationship between the current page and the new tab. For example:

<button type="button" target="_blank" rel="noopener noreferrer" href="https://www.example.com">Open in new tab</button>

This will open the link in a new tab and also prevent the new tab from accessing the current page's cookies and other resources.