00 Votes

HTML: Link should open two independent windows

Question by Compi | 2012-02-08 at 15:11

I want to open two independent windows when you click only one one link. Is this somehow possible with HTML? Up to now, I just only get out to open one page with one link simultaneously.

ReplyPositiveNegative
22 Votes

You have to use JavaScript to get it. First, you have to write the following in the head section of your page:

<script type="text/javascript">
function TwoWindows(a,b){
  window.open(a);
  window.open(b);
}
</script>

With this, we define a JavaScript function called TwoWindows, that accepts the two parameters a and b. The two parameters are our links, we want to open in a new window.

Now we just need to define the link:

<a href="javascript:TwoWindows('1.htm','2.htm');">
Click Me</a>

If we click on this link, we call the function TwoWindows with the parameters 1.htm and 2.htm - these are the two windows that are opened and instead of them, you can use any other page you want (of course, also websites in the form http://www.example.com).
2012-02-09 at 23:09

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.