在firefox中,InstallTrigger.install用于下载xpi文件。什么用于在chrome浏览器中下载crx文件。下载应该在没有用户点击的情况下开始。
答案 0 :(得分:2)
只需更改窗口的位置,使用 window.location.href = "http://.../extension.crx";
。
修改:上述答案已过时,Chrome不再需要从Chrome WebStore以外的任何网站安装扩展程序。
支持inline installation flow,可让您从网站触发扩展程序的安装。这需要您的网站经过验证并与Chrome网上应用店中的扩展程序相关联。然后,您可以在指向Chrome网上应用店中的扩展程序的页面中添加<link rel="chrome-webstore-item">
标记,并且对chrome.webstore.install()
的调用将开始安装。