Use window.location.href=''
instead of window.open('menu.html')
, window.open
will open a new window and this is not what you want ...
You can also use window.location.replace('menu.html')
, but it will replace the current page in the browser history, making it not possible to return to the page after clicking the button.
Option 1 window.location.href=''
:
<button type="submit" onclick="window.location.href='menu.html'">Login</button>
Option 2 window.location.replace()
:
<button type="submit" onclick="window.location.replace('menu.html')">Login</button>
Option 3, a button made of link.
.btnlogin {
background:#000;
border-radius:4px;
padding:4px 6px;
color:#fff;
text-decoration:none;
}
<a href="menu.html" class="btnlogin">Login</a>