I'm modifying a webpage and I would like to create a button that onclick it loads me a new page in the same window. For example, for a link to a webpage with some parameters it could be:
<a href="www.mypage.com/page?param1=abc¶m2=345">LINK TO THE WEBSITE</a>
If I do this, the link loads correctly the website. If I modify it to:
<a href=javascript:window.open("www.mypage.com/page?param1=abc¶m2=345", "_self")>LINK TO THE WEBSITE</a>
I'm successful too. However, I would like to implement this on a button. Therefore I have:
<button
onclick="javascript:window.open('www.mypage.com/page?param1=abc¶m2=345', '_self')"
</button>
However, now it loads "www.mypage.com/page", and the parameters are erased, even I can see in the source code of the website they are there. Why? How can I implement this with a button?
you could wrap the button into the href link.
for example:
<a href=javascript:window.open("www.mypage.com/page?param1=abc¶m2=345", "_self")><button>Click me</button></a>