[英]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. 我建立了一个简单的应用程序,用于在使用Adwords时修改用户在文本区域中输入的单词。 However the javascript file is saying there is an error loading it when I attempt to load my unpacked extension.
但是,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: 这是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. 我已经在Glitch上进行了测试,并且知道我的程序可以正常工作,所以我对可能导致错误的原因感到好奇。 Thanks for any help!
谢谢你的帮助!
checkout your project: 签出您的项目:
"default_popup": "src/browser_action/browser_action.html"
root/src/browser_action/browser_action.html
根/ SRC / browser_action / browser_action.html
"js": [ "js/popup.js" ]
root/js/popup.js
根/ JS / popup.js
browser_action.html
html-code <script src="../../js/popup.js"></script>
browser_action.html
html代码<script src="../../js/popup.js"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.