异步请求后新窗口打开页面,会被浏览器拦截问题

it2022-05-23  76

 

需要在异步调用接口前,先打开新窗口;

在接口返回后,如果确定需要打开新窗口,则设置窗口的 href  地址;

如果不需要,则关闭窗口即可。

 

如:

let newWin = window.open('') this.singleVisit(url, function (toUrl) { if (toUrl) { newWin.location.href = toUrl } }, function () { newWin.close() })这样能解决问题。

转载于:https://www.cnblogs.com/scode2/p/10566644.html

相关资源:数据结构—成绩单生成器

最新回复(0)