chrome ie阻止js弹窗
Open Google
Open Google after 1 second
Open Google after 1 second
Open Google after 1 second
<a href="javascript:void(0);" id="first">Open Google</a><br /><br /> <a href="javascript:void(0);" id="second">Open Google after 1 second</a><br /><br /> <a href="javascript:void(0);" id="last">Open Google after 1 second</a> <br /><br /> <a href="javascript:void(0);" id="last2">Open Google after 1 second</a>
$("#first").click(function(){ window.open("http://www.google.com"); return false; }); $("#second").click(function(){ setTimeout(function(){ window.open("http://www.google.com"); }, 1000); return false; }); $("#last").click(function(){ var w=window.open(); setTimeout(function(){ w.location="http://www.google.com"; }, 1000); return false; }); $("#last2").click(function(){ var w=window.open(); setTimeout(function(){ w.close(); }, 1000); return false; });
貌似只要响应的是用户的操作就可以。
也可以看这个