使用JavaScript安装Chrome Store Web Apps

Chrome Web Store

Being able to install Firefox OS web apps from any domain, not just the platform app store, is a giant step forward in mobile app marketing and freedom.  Firefox OS allows installing apps from any or all domains, and it just so happens that the Chrome Web Store allows JavaScript-triggered app installation as well.

能够从任何领域 (不仅是平台应用商店) 安装Firefox OS Web应用程序,是移动应用程序营销和自由方面迈出的一大步。 Firefox OS允许从任何或所有域安装应用程序,而Chrome Web Store也允许安装由JavaScript触发的应用程序。

JavaScript安装代码 (JavaScript Install Code)

The chrome.webstore.install method accepts three parameters, the install URL, the success callback, and the error callback:

chrome.webstore.install方法接受三个参数,即安装URL,成功回调和错误回调:


/* Chrome installation */
var chromeInstallUrl = "path/to/chrome/app";
chrome.webstore.install(chromeInstallUrl,
function() {
	//  Success!
}, function(err) {
	//  Error :(
});


The code above triggers installation of the Chrome web app at the given location.  The obvious difference from Firefox OS app installation is that callbacks are included in the initial call here, instead of adding adding onsuccess and onerror methods to a resulting install object.

上面的代码触发在给定位置安装Chrome网络应用。 与Firefox OS应用程序安装的明显区别在于,此处的初始调用中包含了回调,而不是在生成的安装对象中添加添加onsuccess和onerror方法。

翻译自: https://davidwalsh.name/chrome-app-install

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值