How to make button in HTML that works like a link and open new tab

To make a button work like a link and open in a new browser tab, you can use the following HTML.

window.open will open a new browser tab as long as your browser can process Javascript.

You can replace ‘yourURL.com’ with the URL of the web page that you want to load. Next, replace “Button Text” with your own text that will appear on the button e.g. “Click Here” or “Press Me”.

<p style="text-align: center;"><button type="button" onclick="window.open('https://yourURL.com','_blank')">Button Text Here</button></p>

Leave a Comment

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