There are several methods to create an HTML button that acts as a link and using href in onclick event is one of them.
Button onclick href Example
HTML example code:-
The onclick event attribute works when the user click on the button.
<html> <body> <button onclick="location.href='http://www.example.com'"> www.example.com</button> </body> </html>
Do comment if you have any doubts and suggestion on this HTML tag topic.
Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.