I have some text in a link. When I click on it I must open 2 pages. No problem here... but the trick is that I am not allowed to use JavaScript. Is this possible only with HTML?
-
3What's the reasoning for not using JS? :-)Karol J. Piczak– Karol J. Piczak2011-04-06 13:19:19 +00:00Commented Apr 6, 2011 at 13:19
-
If it's a no because "just don't use it", then the goal cannot be fulfilled. If there's some more compelling reason, maybe some workaround could be possible.Karol J. Piczak– Karol J. Piczak2011-04-06 13:27:20 +00:00Commented Apr 6, 2011 at 13:27
5 Answers
Without JavaScript, it's not possible to open two pages by clicking one link unless both pages are framed on the one page that opens from clicking the link. With JS it's trivial:
<p><a href="#" onclick="window.open('http://google.com');
window.open('http://yahoo.com');">Click to open Google and Yahoo</a></p>
Do note that this will be blocked by popup blockers built into web browsers but you are usually notified of this.
4 Comments
frameset solution does not work for html5 anymore; anything comparable available?<a href="http://www.omsaicreche.blogspot.com" onclick="location.href='http://www.omsaivatikanoida.blogspot.com';" target="_blank">Open Two Links With One Click</a>
I tried the above codes. I could not get success in old page. Than I created a new page in blogger and types following codes... I was successful
1 Comment
mailto:, meaning your link goes to a new page and also sends some email, you need to put the mailto: URL in the location.href= and change target="_blank" to target="_self"If you have the authority to edit the pages to be opened, you can href to 'A' page and in the A page you can put link to B page in onpageload attribute of body tag.
1 Comment
it is working perfectly;
<p><a href="#"onclick="window.open('http://google.com');window.open('http://yahoo.com');">Click to open Google and Yahoo</a></p>