通过链接安装Firefox插件,而不是下载.xpi [英] Install Firefox Addon from a link, instead of downloading the .xpi

查看:57
本文介绍了通过链接安装Firefox插件,而不是下载.xpi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚制作了一个FF插件,并制作了一个简单的网站.我希望访问者单击加载项的下载"按钮来安装,而不是下载.它在本地工作,但在我上载网站时不起作用.我检查了mozilla存储库,它们也只是链接到xpi文件.

I just made a FF addon and made a simple website. I'd like when a visitor clicks the "download" button the addon to install, instead of getting downloaded. It works locally, but not when I upload the site. I checked the mozilla repository, they just link to the xpi file as well.

我在做什么错了?

推荐答案

问题是您尚未为网站注册XPI MIME类型.您可以通过在网站的.htaccess文件中添加以下规则来实现此目的(假设您的网站使用的是Apache服务器):

The problem is that you haven't registered the XPI MIME type for your website. You can do this by adding the following rule to your site's .htaccess file (assuming your site uses an Apache server):

AddType application/x-xpinstall .xpi

这应该得到您想要的(用户单击链接并提示您安装XPI文件).

This should result in what you want (a user clicks the link and is prompted to install the XPI file).

更多参考资料 https://developer.mozilla.org/en -US/附加组件/Extension_Packaging#Making_an_extension_XPI

这篇关于通过链接安装Firefox插件,而不是下载.xpi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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