我正在开发简单的 Chrome 打包应用程序。我是 chrome 应用程序开发的新手。运行应用程序时出现错误。
错误消息是:无法打开指向“chrome-extension://ckikacajammagdadocdkmcoecilafkgl/index.html”的相同窗口链接;尝试目标 =“_blank”。
索引 HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My first Chrome App</title>
<script src="jquery-1.10.2.min.js"></script>
<script src="custom.js"></script>
</head>
<body>
<button id="btnTest" value="Test" style="width: 200px; height: 40px">TEST</button>
<br />
<input type="text" id="txtTest" />
<div id="divMovies" style="width: 100%;">
<br />
Url :
</div>
</body>
</html>
自定义.js:
$(document).ready(function () {
save(load);
});
function save(callback) {
var channel = "Test local storage item test";
chrome.storage.local.set({ 'channel': channel });
callback();
}
function load() {
var channelss = "";
chrome.storage.local.get('channel', function (result) {
channelss = result;
});
document.getElementById("txtTest").value = channelss.channel;
}
清单.json:
{
"manifest_version": 2,
"name": "Dizi Takip App",
"version": "1",
"app": {
"background": {
"scripts": ["main.js"]
}
},
"icons": { "128": "icon.png" },
"offline_enabled": true,
"permissions": [
"storage"
]
}
主.js:
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {width: 500, height: 309});
});
怎么了?