我想在执行chrome.tabs.executeScript...时避免chrome.runtime.lastError

问题描述

我正在开发铬扩展剂。 我尝试使用chrome.tabs.executeScript注入脚本标签,但是在特定的URL中会发生一些错误

我使用this page作为参考,但是控制台中有很多错误日志...

我知道我的扩展程序无法在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)
  }       
})

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)