【发布时间】:2021-05-13 06:45:37
【问题描述】:
我试图在我的 chrome 扩展中实现一些东西,如果输入密码(管理员),它将执行 chrome 扩展(contentScript)
我已经做了一些尝试,但我正在努力执行密码输入正确的脚本
我不是最擅长在 popup.html 中实现 html 的,而且在我的最小的地方是非常基本和标准的,如果有人可以帮助这部分,那就太好了,谢谢
这是我的 manifest.json
{
"browser_action": {
"default_icon": "icon16.png",
"default_popup": "popup.html"
},
"content_scripts": [ {
"js": [ "jquery.min.js", "js/contentScript.js" ],
"matches": [ "*://www.ea.com/*fifa/ultimate-team/web-app/*" ]
} ],
"content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'",
"description": "A great tool that interacts with the FIFA 21 WEB APP to highlight the best deals going!",
"icons": {
"128": "icon128.png",
"16": "icon16.png",
"48": "icon48.png"
},
"manifest_version": 2,
"name": "kappas x",
"permissions": [ "storage", "identity", "identity.email"],
"update_url": "https://clients2.google.com/service/update2/crx",
"version": "12.9.3"
}
还有我的 popup.html
<body>
<div class="modal-header">
<h1 class="logo">
<img class="logo-icon" src="icon128.png" />Kappas
<span class="version">(1.0.0)</span>
</h1>
</div>
<div class="modal-content">
<p>Number #1 Web App Tool For Fifa 21!</p>
<form>
<label for="pswd">Enter your password: </label>
<input type="password" id="pswd">
<input type="button" value="Submit" onclick="checkPswd();" />
</form>
<!--Function to check password the already set password is admin-->
<script type="text/javascript">
function checkPswd() {
var confirmPassword = "admin";
var password = document.getElementById("pswd").value;
if (password == confirmPassword) {
window.location="contentScript.js";
}
else{
alert("Passwords do not match.");
}
}
</script>
</div>
</body>
</html>
【问题讨论】:
标签: javascript authentication google-chrome-extension passwords