使用ajax回调后,通过js点击某个超链接(target为_blank),结果给ie自带的弹出窗口阻止程序拦截掉了
这种问题如何解决
这种问题如何解决
解决方案 »
- onkeydown触发后,是不是不会再触发onkeypress?
- FieFox下file无法用JS触法click事件?
- 为什么这里不能用变量?
- JS如何实现一行一行的读取txt里的内容 目前只能读第一行或者读取全部
- Extjs Ext.Ext.create传参数的问题
- 大家来看看,做的非常经典!
- 大家帮忙看看这个网址左边蓝色的那个菜单怎么做的啊,http://www.math.pku.edu.cn/index_cn_2004.asp
- 如何使多选select框的内容为选中状态
- 請教像郵箱附件的下載鏈接是怎樣做的!高分相送
- 为什么会出现这样的问题?
- js 键值对问题
- 虽有在CSS中定义div标签的WIDTH样式,为什么用js取不出来相应的值??
让用户更改设置,肯定是不用考虑的现在只是考虑换流程,问题是与服务端交互是要的,弹出新窗口也是要的,不知道有什么好的方法
function linkClick(url,linkid){
var but = document.getElementById(linkid);
but.href = url;
but.target = "_blank";
but.click();
} function ajax(url,tempCallback){
var method="GET";
if(window.XMLHttpRequest){
var xmlhttp = new XMLHttpRequest();
}else if(window.ActiveXObject){
try{ var xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){ var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
if (xmlhttp == null) return;
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4) {
if (xmlhttp.status >= 200 && xmlhttp.status < 300) {
tempCallback(url,xmlhttp.responseText);
}
}
};
xmlhttp.open(method, url, true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlhttp.setRequestHeader("If-Modified-Since","0");
xmlhttp.send(null);
}
window.onload=function(){
ajax("http://www.baidu.com",function(url,ttt){
alert(ttt);
linkClick(url,"test0")
})
ajax("http://www.google.com.hk/",function(url,ttt){
alert(ttt);
linkClick(url,"test1")
})
}
</script><a id="test0">百度</a>
<a id="test1">google</a>
if (xmlHttp.readyState == 4) {
var response = xmlHttp.responseText;
try{
document.getElementById("logdiv").innerHTML=response;
showClickContent();
}catch(exception){}
}
}function showClickContent()
{
document.getElementById("openref").href=WebGoUrl;
document.getElementById("openref").click();
}
function getDivOk(){
if (xmlHttp.readyState == 4&&(xmlHttp.status==200||xmlHttp.status==0)){
var response = xmlHttp.responseText;
try{
document.getElementById("logdiv").innerHTML=response;
showClickContent();
window.open(WebGoUrl,'ajaxopen')//这里直接打开
}catch(exception){}
}
}function showClickContent(){
document.getElementById("openref").href=WebGoUrl;
//document.getElementById("openref").click();//多此一举不是吗?
//other codes................
}
现在是通过点击超链接都给ie拦截了,open就更不用说了
比如你是客户你当然不希望更改自己的浏览器设置了
所以呢还是想办法解决,不要期望更改客户端的浏览器设置,人家就是不改,你能怎么着?!客户就是客户建议用div层的方式去实现
我之前有做过一个系统登录的强制通知弹出框
也就是用户一登录就能看到弹出信息
也是遇到了楼主的问题,会被ie拦截,或是用户ie设置屏蔽掉了最后我用div层的方式实现弹出窗口效果
现在不管怎么设置也拦截不到我那弹出窗口以上是个人一点建议,仅供参考
弹出的窗口已经不是本网站的,所以用div的办法不行
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.open("http://www.baidu.com","_blank");
</script>
</head><body>
</body>
</html>