谷歌浏览器插件中的onLaunched错误 [英] Google Chrome 'onLaunched' error in plugin

查看:420
本文介绍了谷歌浏览器插件中的onLaunched错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 http://developer.chrome上关注Google Chrome网络应用程序开发。 com / trunk / apps / first_app.html ,并且该Web应用程序未启动。当我点击页面上的应用程序图标时,它会关闭选项卡。我已经从github下载了示例应用程序和插件,但是他们也无法正常工作,当我查看控制台时出现此错误,请不要在Chrome:// flags中启用实验性API。

I am following the google chrome web app development on http://developer.chrome.com/trunk/apps/first_app.html and the web app is not launching. when i click on the app icon on the page it closes the tab. I have downloaded the sample apps and plugins from github but they too are not working when i look at the console i get this error, please not i have enabled experimental API's in chrome://flags.

Uncaught TypeError: Cannot read property 'onLaunched' of undefined 

我已将Chrome浏览器更新至版本22.0.1229.79。我的manifest.json文件是

I have updated my chrome browser to version 22.0.1229.79. My manifest.json file is

{
"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文件

And my background.js file

   chrome.app.runtime.onLaunched.addListener(function() {
    chrome.app.window.create('window.html', {
        'width': 400,
        'height': 500
    });
});

有人能指出我哪里出错了吗?

Can someone point me where am going wrong?

推荐答案

获取 Chrome的开发/测试版副本至少是版本23.

Get a dev/beta copy of Chrome that is at least version 23.

我还必须在manifest.json文件中添加以下行,然后才能使样本运行

I also had to add the following line to the manifest.json file before I could get the sample to run

{
  ...,
  "minimum_chrome_version": "23",
  ...
}

这篇关于谷歌浏览器插件中的onLaunched错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆