javascript - 我想在执行 chrome.tabs.executeScript(...) 时避免 chrome.runtime.lastError
问题描述
我正在开发 chrome 扩展。我尝试使用 注入脚本标签chrome.tabs.executeScript
,但它在特定 URL 中发生了一些错误。
我使用此页面作为参考,但控制台中有很多错误日志...
我知道我的扩展程序无法在 Chrome 网上商店或 Chrome 内部页面上运行,我对此表示满意,但该显示让用户看起来就像扩展程序已损坏一样。我想以某种方式避免错误(例如,URL 访问过滤器??),但我不知道该怎么做。
谁能给我一些建议??
chrome.tabs.executeScript(e.tabId, {"allFrames": false, "matchAboutBlank": true, "runAt": 'document_start', "frameId": e.frameId, "file": "/inject.js"}, function(){
if(chrome.runtime.lastError){
console.error(chrome.runtime.lastError.message)
}
})
解决方案
推荐阅读
- swift - 使用 Swift 的 PDFKit 中的灵活部分
- python - 在 Pandas DF 中提取特定年份的行
- terraform - Terraform:EKS - 仅使用私有子网创建集群
- python - 仅当距离足够大时,如何将精灵添加到精灵组
- python - Python 对 CSV 文件中的数据进行排序
- javascript - RequireJs 和 Knockout 的继承问题
- python - 如果一个是小数,我如何使用按位将两个数字相乘?
- amazon-s3 - Ansible Dry Run 未捕获上一个任务中创建的资源
- r - R - 将自定义函数应用于由另一列分组的数据框中的列
- angular - 在 primeNg 数据表中停用选择模式