javascript - 在 Internet Explorer 11 控制台中执行 JQuery 代码时出现 "You are not currently attached to a supported page or app."错误

标签 javascript jquery debugging console internet-explorer-11

我正在尝试在 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 选项 > 安全 > 点击自定义级别按钮 > 在脚本下,启用事件脚本 > 确定

Sample Image

重新启动 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/

相关文章:

javascript - onclick 与 Cakephp html 输入

javascript - 在这种情况下使用 jquery 获取原始 url

javascript - 延迟进度指示器

java - 在数组中添加数字

javascript - Ajaxcontroltoolkit VS。查询

javascript - findOneAndUpdate Mongoose w/PUT REST API

javascript - Jquery 处理两个具有相同 ID、相同名称和相同值的输入字段

javascript - jQuery 自动完成,发生更改事件

debugging - ADPlus/CDB 的不一致行为 - 'g' 中没有可运行的调试器错误

javascript - 在 chrome 开发者工具中禁用 debugger 语句