Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension

前端 未结 3 1018
感情败类
感情败类 2020-12-14 06:56

I have tried many ways( all documented procedures)to inject script into a specific page upon checking URL at onUpdated.addListener. Finally the below code with \'executescri

3条回答
  •  自闭症患者
    2020-12-14 07:41

    UPDATE: Finally figured out your problem. In eventPage.js, you tried to inject js/Leoscript.js, which is NOT whitelisted, instead of js/LeoScript.js (with a capital 'S'), which is whitelisted. Note that URLs are case-sensitive!

    chrome.tabs.executeScript(tabId, {file: 'js/LeoScript.js'});
    

    LeoScript.js:

    alert('injected');
    document.getElementById('username').value='aaaaaaa';
    

提交回复
热议问题