Adding the XPI MIME Type for Firefox Extension Installs

By  on  

Yesterday I posted version 0.1 of the David Walsh Blog Toolbar for Firefox. Unfortunately that led to an awkward conversation with my .htaccess file.

.htaccess: I have no idea what to do with this.
me: I want the toolbar to install when they request this file.
.htaccess: Well, how am I supposed to do that?
me: OMG! You don't know?!
.htaccess: No, just like you didn't know how to create a Firefox extension before you did the research.
me: Good point. When can you research and start serving it up?
.htaccess: I can't research. I'm a file.
me: Oh. So I just need to figure things out for you again?
.htaccess: You never pay attention to me anymore...

That went on for quite a while but the moral of the story is that if you want your server to handle XPI files correctly, you need to add the following to your .htaccess file:

AddType application/x-xpinstall .xpi

If you don't add the above directive, Firefox will open the file as plain text which is an ugly mess.

Recent Features

  • By
    CSS Animations Between Media Queries

    CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during...

  • By
    5 Ways that CSS and JavaScript Interact That You May Not Know About

    CSS and JavaScript:  the lines seemingly get blurred by each browser release.  They have always done a very different job but in the end they are both front-end technologies so they need do need to work closely.  We have our .js files and our .css, but...

Incredible Demos

  • By
    MooTools Typewriter Effect Plugin

    Last week, I read an article in which the author created a typewriter effect using the jQuery JavaScript framework. I was impressed with the idea and execution of the code so I decided to port the effect to MooTools. After about an hour of coding...

  • By
    Implement jQuery’s hover() Method in MooTools

    jQuery offers a quick event shortcut method called hover that accepts two functions that represent mouseover and mouseout actions. Here's how to implement that for MooTools Elements. The MooTools JavaScript We implement hover() which accepts to functions; one will be called on mouseenter and the other...

Discussion

  1. Only a web dev could have some kind of decent conversation with a file!

    I did wonder why it didn’t install when I clicked it, good to see you found out why though. The ever brilliant David saves the day!

  2. Awesome :)

    Is it just me or are .htaccess files getting increasingly uppity lately?

  3. You’re hilarious, dude! Have fun in Cali!!

  4. Facundo

    LOL! i used to have long talks whit .htaccess too.

  5. I envy your relationship with your .htaccess file.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!