0
我的代码工作正常,在Chrome DevTools,但现在我想我的延伸,从铬调试器面板移动到我的分机的弹出窗口。替代“inspectedWindow”(不适用于铬devtools)
特别是我有这个代码的问题:
function callCommand(cmd) {
chrome.devtools.inspectedWindow.eval(
cmd,
{useContentScriptContext: true},
function (isException, result) {
if (isException || chrome.runtime.lastError) {
console.error('Error', cmd, result, chrome.runtime.lastError);
}
}
);
显然铬调试工具说Cannot read property 'inspectedWindow' of undefined
因为inspectedWindow只能在铬devtools。
我该如何实现它不同?
为什么你就不能使用tabs.executeScript? –