场景是ajax提交,比较后端效验数据,需要用户登录,提示后并需要新窗口打开登录的链接,使用window.open(url);往往会被浏览器认为是广告而被拦截。
data.url是ajax返回的链接地址
1 //window.open(data.url); #新窗口打开链接,浏览器会当成广告阻截,所以改换以下方式 :
2
3 var strA=document.createElement("a");
4 strA.target="_blank";
5 strA.>;
6 strA.href=data.url;
7 strA.text="测试";
8 strA.style.display="none";
9 document.body.appendChild(strA);
10 document.getElementById("alogin").click();
11
12 //$("#asetpaypwd").click(); 测试,这里使用jquery是不行的
相关文章:
-
2022-12-23
-
2021-10-20
-
2021-11-30
-
2022-02-13
-
2021-11-28
-
2021-12-19
-
2022-12-23
-
2021-05-26