HTML button opening link in new tab
Asked 07 September, 2021
Viewed 1.1K times
  • 52
Votes

So this is the simple code for the button to open a certain link

                <button class="btn btn-success" onclick="location.href='http://google.com';"> Google</button>

but it opens it on the same page, I want the link to open on a new tab though.

10 Answer