我正在關注http://developer.chrome.com/trunk/apps/first_app.html上的谷歌Chrome網頁應用程序開發,並且該網絡應用程序未啓動。當我點擊頁面上的應用程序圖標時,它會關閉選項卡。我已經從github下載了示例應用程序和插件,但是他們也無法正常工作,當我查看控制檯時,出現此錯誤,請不要在Chrome:// flags中啓用實驗性API。谷歌瀏覽器插件中的'onLaunched'錯誤
Uncaught TypeError: Cannot read property 'onLaunched' of undefined
我已將Chrome瀏覽器更新至22.0.1229.79版。我的manifest.json文件
{
"name": "Hello World!",
"description": "My first packaged app.",
"manifest_version": 2,
"version": "0.1",
"app": {
"background": {
"scripts": ["background.js"]
}
},
"icons": {
"16": "calculator-16.png",
"128": "calculator-128.png"
}
}
而且我background.js文件
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('window.html', {
'width': 400,
'height': 500
});
});
有人能指出我在哪裏,我的問題呢?
我有一個類似的問題([見這裏](http://stackoverflow.com/questions/12647445/chrome-plugin-not-initializing-properly)),似乎在我重新啓動瀏覽器時解決。我一直在運行很多標籤,瀏覽器已經打開了一段時間。 –
我最終改變我的清單看起來像這樣'{ 「名」: 「Qlipe」, 「說明」: 「Qlipe Chrome應用」, 「manifest_version」:2, 「版本」: 「0.1」, 「應用程序」:{ 「發射」:{ 「LOCAL_PATH」: 「的index.html」 } }, 「圖標」:{ 「16」: 「Qlipe-16.png」, 「128」 :「Qlipe-128.png」 }, 「permissions」:[ 「http://www.qlipe.com/api/feed」, 「http://0.0.0.0:6543/api/feed」 , 「unlimitedStorage」 ]'注意我刪除了背景js – Madawar
有趣的。當我有機會時,我會玩。你有沒有嘗試過指定background.html並在其中嵌入JavaScript? –