开发者

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

开发者 https://www.devze.com 2023-04-05 08:34 出处:网络
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

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 开发者_JAVA技巧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?


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 :)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号