在我的Chrome扩展程序中,只有2页 - popup.html 和 result.html 。 两个页面具有相同的ID,具有相同的ID。表单包含1个输入框和一个提交按钮。
我面临三个问题
globalURL
我是新手并试图解决过去2天的问题。在stackoverflow上有很多解决方案,在google上没有适合要求的
请帮助!!
Manisfest -
{
"manifest_version": 2,
"name": "Seolyzer",
"description": "Analyze your websites now.",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"background": {
"scripts": ["assets/js/jquery.js", "assets/js/myapp.js"]
},
"permissions": [
"webRequestBlocking",
"webRequest",
"*://*.google.com/",
"<all_urls>",
"storage",
"tabs",
"http://*/*",
"https://*/*"
],
"js": ["content.js"]
}
Popup.html
<!DOCTYPE html>
<html>
<head>
<title>-Result</title>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/boostrap-mini.js"></script>
<script src="assets/js/myapp.js"></script>
</head>
<body>
<form class="form-inline" method="post" id="domain1" action="result.html" target="_blank">
<div class="input-group">
<input type="text" required="required" name="domain" placeholder="Enter your domain here" class="form-control input-lg" id="domain inputlg" style="height:49px;font-size:larger;">
<div class="input-group-btn" style="width:1%;">
<button type="submit" class="btn btn-success" id="urlbutton" style="height:49px;"><i class="glyphicon glyphicon-stats"> </i>Analyze it</button>
</div> </div>
</form>
</body>
</html>
Result.html
<!DOCTYPE html>
<html>
<head>
<title>-Result</title>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/boostrap-mini.js"></script>
<script src="assets/js/myapp.js"></script>
</head>
<body>
<form class="form-inline" method="post" id="domain1" action="result.html" target="_blank">
<div class="input-group">
<input type="text" required="required" name="domain" placeholder="Enter your domain here" class="form-control input-lg" id="domain" style="height:49px;font-size:larger;">
<div class="input-group-btn" style="width:1%;">
<button type="button" class="btn btn-success" id="urlbutton" style="height:49px;"><i class="glyphicon glyphicon-stats"> </i>Analyze it</button>
</div> </div>
</form>
</body>
</html>
Myapp.js
var globalURL="google.com"
$(function(){
$('#urlbutton').click(function(){
var urll="facebook.com";
globalURL= urll;
if(urll)
{
console.log("New "+ urll);
}
else
{
console.log("no");
}
})})
console.log(globalURL);