我想知道无论如何我可以强制popup.html关闭?
我刚买了WebStorm 5,到目前为止一直非常享受它的检测功能.我在开发Chrome扩展程序时遇到的一个问题是它无法识别chrome变量:

有没有办法可以将chrome变量添加到Inspector中,以便它可以在我输入时自动完成?我猜我需要将Chromium添加为外部库,但我不确定从哪里开始.
javascript autocomplete intellij-idea google-chrome-extension webstorm
我可以为Google Chrome MOBILE(Android Google Chrome)创建插件或扩展程序吗?
如果没有,我可以为Google Chrome(桌面版)创建一个扩展程序,它会在Google Chrome栏中添加一个按钮.此按钮将在另一个Web浏览器中打开页面(在我自己的Web浏览器中),因此,此按钮应启动我自己的Web浏览器.
我知道这已经在很多帖子中被问过,但说实话,我没有得到它们.我是JavaScript,Chrome扩展程序以及所有内容的新手,我有这个课程作业.所以我需要创建一个插件,使用跨域请求计算任何给定页面上的DOM对象.到目前为止,我已经能够使用Chrome Extension API实现这一目标.现在问题是我需要在contentScript.js文件中的popup.html页面上显示数据.我不知道该怎么做我已经尝试阅读文档但是在chrome中发送消息我只是无法理解该怎么做.
以下是到目前为止的代码.
的manifest.json
{
"manifest_version":2,
"name":"Dom Reader",
"description":"Counts Dom Objects",
"version":"1.0",
"page_action": {
"default_icon":"icon.png",
"default_title":"Dom Reader",
"default_popup":"popup.html"
},
"background":{
"scripts":["eventPage.js"],
"persistent":false
},
"content_scripts":[
{
"matches":["http://pluralsight.com/training/Courses/*", "http://pluralsight.com/training/Authors/Details/*", "https://www.youtube.com/user/*", "https://sites.google.com/site/*", "http://127.0.0.1:3667/popup.html"],
"js":["domReader_cs.js","jquery-1.10.2.js"]
//"css":["pluralsight_cs.css"]
}
],
"permissions":[
"tabs",
"http://pluralsight.com/*",
"http://youtube.com/*",
"https://sites.google.com/*",
"http://127.0.0.1:3667/*"
]
Run Code Online (Sandbox Code Playgroud)
popup.html
<!doctype html>
<html>
<title> Dom Reader </title>
<script src="jquery-1.10.2.js" type="text/javascript"></script>
<script src="popup.js" type="text/javascript"></script>
<body>
<H1> Dom Reader </H1>
<input type="submit" id="readDom" value="Read DOM Objects" />
<div id="domInfo">
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
eventPage.js
var value1,value2,value3;
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) …Run Code Online (Sandbox Code Playgroud) html javascript jquery google-chrome google-chrome-extension
如何在chrome中设置自定义协议处理程序?就像是:
myprotocol:// testfile的
我需要将此请求发送到http://example.com?query=testfile,然后将httpresponse发送到我的扩展程序.
当我将新版Chrome扩展程序推送到Chrome网上应用店时,更新版本需要多长时间才能覆盖当前用户?
我在六个小时前推了一个更新,但扩展还没有为我更新.Chrome文档尚不清楚.
我有一个镀铬扩展,它挂钩到devtools.理想情况下,我想要一个徽章,当点击它时,会打开我创建的新选项卡上的devtools.有没有办法从后台页面这样做?
我知道这个问题已经以不同的方式反复提出,但我试图通过所有的答案(希望我没有错过任何人),但没有一个对我有用.
这是我的扩展程序代码:
表现:
{
"name": "test",
"version": "1.1",
"background":
{
"scripts": ["contextMenus.js"]
},
"permissions": ["tabs", "<all_urls>", "contextMenus"],
"content_scripts" : [
{
"matches" : [ "http://*/*" ],
"js": ["jquery-1.8.3.js", "jquery-ui.js"],
"css": [ "jquery-ui.css" ],
"js": ["openDialog.js"]
}
],
"manifest_version": 2
}
Run Code Online (Sandbox Code Playgroud)
contextMenus.js
function onClickHandler(info, tab) {
if (info.menuItemId == "line1"){
alert("You have selected: " + info.selectionText);
chrome.extension.sendMessage({action:'open_dialog_box'}, function(){});
alert("Req sent?");
}
}
chrome.contextMenus.onClicked.addListener(onClickHandler);
chrome.runtime.onInstalled.addListener(function() {
chrome.contextMenus.create({"id": "line1", "type": "normal", "title": "I'm line 1", "contexts":["selection"]});
});
Run Code Online (Sandbox Code Playgroud)
openDialog.js
chrome.extension.onMessage.addListener(function(msg, sender, sendResponse) {
if …Run Code Online (Sandbox Code Playgroud) background sendmessage google-chrome-extension content-script
我有一个chrome扩展名.我需要从当前页面的HTML源代码进行分析.我在这里找到了各种带有背景页面和内容脚本的解决方案,但没有人帮助我.这是我到目前为止:
manifest.json:
{
"name": "Extension",
"version": "1.0",
"description": "Extension",
"browser_action": {
"default_icon": "bmarkred.ico",
"popup": "Test.html"
},
"content_scripts": [
{
"matches": ["http://*/*"],
"js": ["content.js"]
}
],
"background": {
"page": "backgroundPage.html"
},
"permissions": [
"cookies",
"tabs",
"http://*/*",
"https://*/*"
]
}
Run Code Online (Sandbox Code Playgroud)
background.html:
<html>
<head>
<script type="text/javascript">
try {
chrome.tabs.getSelected(null, function (tab) {
chrome.tabs.sendRequest(tab.id, {action: "getSource"}, function(source) {
alert(source);
});
});
}
catch (ex) {
alert(ex);
}
</script>
</head>
</html>
Run Code Online (Sandbox Code Playgroud)
content.js:
chrome.extension.onRequest.addListener(function(request, sender, callback) {
if (request.action == "getSource") {
callback(document.getElementsByTagName('html')[0].innerHTML);
}
});
Run Code Online (Sandbox Code Playgroud)
警报始终警告未定义.即使我在content.js文件中将回调函数更改为: …
我想制作一个chrome扩展,在加载一个页面后执行一些脚本,我不确定是否必须在后台页面上实现这个逻辑,或者它可以在任何其他地方,这里的任何帮助将不胜感激.
javascript ×5
html ×2
auto-update ×1
autocomplete ×1
background ×1
jquery ×1
sendmessage ×1
updates ×1
webstorm ×1