zozo
zozo

Reputation: 8592

How can I open two pages from a single click without using JavaScript?

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?

Upvotes: 25

Views: 148046

Answers (5)

vaibhav
vaibhav

Reputation: 11

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>

Upvotes: -9

Marcel
Marcel

Reputation: 28087

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.

Upvotes: 45

Dharmesh
Dharmesh

Reputation: 131

<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

Upvotes: 12

takirala
takirala

Reputation: 2019

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.

Upvotes: 1

JohnSmith
JohnSmith

Reputation: 4688

it is not possible to do using only html

Upvotes: 4

Related Questions