嗨,我试图创建一个铬的扩展,因为我的应用程序的扩展,我遵循以下步骤,
1.转到chrome选项-> More tools ->扩展。
2.在该窗口中选择了开发人员模式。
3.选择了解压缩扩展,然后选择了应用程序。
4.点击包分机。
在我的应用程序中,我有几个html页面,CSS、JS和清单文件以及background.js。
清单文件
{
"name": "...",
"description": "........",
"manifest_version": 2,
"minimum_chrome_version": "23",
"version": "0.1.1",
"offline_enabled": true,
"icons": {
"16": "sample.png"
},
"permissions": [
"storage","tabs","<all_urls>","webview"
],
"app": {
"background": {
"scripts": ["background.js"]
}
}
}background.js
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('login.html', {
id: 'main',
bounds: { width: 1024, height: 768 }
});
});当包含选项卡的权限时,我将收到以下警告:
There were warnings when trying to install this extension:
'tabs' is only allowed for extensions and legacy packaged apps, but this is a packaged app.我的应用程序不被认为是一个extension.And,我正在尝试这个页面导航。我通常在jquery中使用window.location.href="sample.html"。为此,我在我的chrome扩展程序中出现了一个错误,
Use blank _target然后我试着用这行密码,
function clickHandler(e){
chrome.tabs.update({url:"service1.html"});
window.close();
}
document.addEventListener('DOMContentLoaded',function(){
document.getElementById('click-me').addEventListener('click',clickHandler);
});这段代码也不是working.Can,请帮我把我的应用程序做一个扩展,并提前在页面navigation.Thanks中帮助我。
https://stackoverflow.com/questions/37043354
复制相似问题