You can try this in the anchor tag. Where in anchor tag use onclick method with the open method. Define both links using the open method, it will open two links with one click.
Example code open two links without JavaScript
HTML example codes:
Window open method
<html>
<body>
<a href="#" onclick="window.open('http://google.com');
window.open('http://yahoo.com');">Click to open Google and Yahoo</a>
</body>
</html>
Using href
attribute
It will open 3 links on single click
<html>
<body>
<a href="http://www.microsoft.com" target="_blank" onclick="window.open('http://www.google.com'); window.open('http://www.yahoo.com');">Click Here</a>
</body>
</html>
Output:
Do comment if you have any doubts and suggestions on this HTML link topic.
Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version
Hi !! I tried your first code. It didn’t work. It only opens one link.
It’s because your browser detects multiple links as virus and blocks it. You can allow this. Go figure out lmao
Hello Rohit,
I hope you are doing well.
Thank you for posting this code. I just have one question.
How do we prefill a data on these websites in a particular space once we click the ” click here” .
Regards
Arjun