我正在尝试在 IE 11 控制台中执行以下代码:
var alinks = $('a');
for (var i = 0; i < alinks.length; i++) {
if ($(alinks[i]).text().trim() == "Contact Management") {
alinks[i].click();
break;
}
}
但我收到以下错误:
You are not currently attached to a supported page or app.
我在 Google 和 SO 上进行了研究,但没有找到此错误的任何解决方案或原因。
我还尝试在 Chrome 和 Firefox 中运行这段代码,并且运行良好。
更新
我也试过简单的 console.log('s')
但它显示 undefined
而没有显示 s
。此外,执行 alert('s')
时没有警报。
最佳答案
转到工具> Internet 选项 > 安全 > 点击自定义级别按钮 > 在脚本下,启用事件脚本 > 确定
重新启动 Internet Explorer
锄它工作:)
关于javascript - 在 Internet Explorer 11 控制台中执行 JQuery 代码时出现 "You are not currently attached to a supported page or app."错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50588010/