简体   繁体   中英

Cannot Load Chrome Extension Javascript File

I have built a simple app to modify words a user inputs into a text area when working with Adwords. However the javascript file is saying there is an error loading it when I attempt to load my unpacked extension.

chrome扩展javascript文件加载错误

Here is my manifest:

 { "name": "Keyword Modifier", "version": "1.0", "manifest_version": 2, "description": "Just copy/paste your keywords and modify them in bulk.", "icons": { "16": "icons/icon16.png", "48": "icons/icon48.png", "128": "icons/icon128.png" }, "default_locale": "en", "browser_action": { "default_icon": "icons/icon19.png", "default_title": "Keyword Modifier", "default_popup": "src/browser_action/browser_action.html" }, "content_scripts": [ { "matches": [ "https://www.google.com/*" ], "js": [ "js/popup.js" ] } ] } 

and here is the javascript:

 var keywordBox = document.getElementById('keywordBox'); var phraseButton = document.getElementById('phraseButton'); var exactButton = document.getElementById('exactButton'); var modifiedButton = document.getElementById('modifiedButton'); phraseButton.addEventListener('click', function() { keywordBox.value = ('"' + keywordBox.value + '"'); keywordBox.value = keywordBox.value.replace(/\\n/g, '"\\n"'); }); exactButton.addEventListener('click', function () { keywordBox.value = ('[' + keywordBox.value + ']'); keywordBox.value = keywordBox.value.replace(/\\n/g, ']\\n['); }); modifiedButton.addEventListener('click', function () { keywordBox.value = keywordBox.value.replace(/^/gm, "+") keywordBox.value = keywordBox.value.replace(/ /g, ' +') }); 

I've tested this on Glitch and know my program works correctly so Im curious as to what could be causing the error. Thanks for any help!

checkout your project:

"default_popup": "src/browser_action/browser_action.html"

root/src/browser_action/browser_action.html

"js": [ "js/popup.js" ]

root/js/popup.js

browser_action.html html-code <script src="../../js/popup.js"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM