单击<a>?

时间:2018-12-18 14:34:29

标签: javascript

I am trying to replace window.open(file_path), which doesn't work satisfactorily in browser windows without toolbars (edge, chrome). With code using script clicking on anchor (simplified form SO:easiest way to open a download window without navigating away from the page)时如何检测是否调用了下载

var a = document.createElement('A');
a.href = file_path;
a.click();

问题在于原始代码具有检测到窗口打开被阻止(弹出窗口阻止程序)的功能

var wnd = window.open(docurl)
if (wnd != null) {/*...*/}

是否有可能检测到点击锚点而阻止下载?

0 个答案:

没有答案