Evik James
Evik James

Reputation: 10503

Click an A link and open multiple new windows that go to different URLs?

I am doing a web site for someone who swears the way his old site worked was that when a user clicked on a specific link, the link would open up multiple browser windows with each going to a different destination.

Specifically, the link would say something like "compare prices" and clicking the link would open up a new window for Amazon.com, Bargains.com, and Overstock.com.

I do not believe I have ever seen this done without the use of JavaScript, like porn sites used to do (and maybe they still do but I don't visit them). And didn't most browsers implement measures to stop multiple windows from opening at once?

Can you tell me whether this can be done and should it be done?

Upvotes: 2

Views: 2806

Answers (2)

benhowdle89
benhowdle89

Reputation: 37504

http://www.webdeveloper.com/forum/showthread.php?t=72649 This not also has the answers to your question but also good opinions on why its not great to have this action in place :)

Upvotes: 1

Saeed Neamati
Saeed Neamati

Reputation: 35852

You can do it client-side:

$('#link-id').click(function(e){
    e.preventDefault();
    window.open('http://www.google.com');
    window.open('http://www.yahoo.com');
    window.open('http://www.msn.com');
});

Check this fiddle.

Upvotes: 1

Related Questions