Firefox trying to download local .swf files

Solution 1:

After some digging into this myself, I've discovered it is a MIME type issue. Firefox (or Chrome) on Linux won't play SWF files if it thinks the type is application/vnd.adobe.flash.movie.

Per https://askubuntu.com/questions/478169/why-cant-firefox-run-local-swf-files:

Edit /usr/share/mime/packages/freedesktop.org.xml as root and replace the following:

<mime-type type="application/vnd.adobe.flash.movie">

With:

<mime-type type="application/x-shockwave-flash">

And then run:

update-mime-database /usr/share/mime

I found I needed to restart Firefox after. Here's a script very close to one from http://ubuntuforums.org/showthread.php?t=2218732&page=2 that performs these steps (run it with sudo), but I will warn you -- I noticed that different installs seem to have different spacing, which can trip up the sed script, which is what happened to me.

#!/bin/bash
clear
echo "Update file freedesktop.org.xml...";
sed  -e "s/<mime-type type=\"application\/vnd.adobe.flash.movie\">/<mime-type type=\"application\/x-shockwave-flash\">/g"  /usr/share/mime/packages/freedesktop.org.xml >  /usr/share/mime/packages/freedesktop.org.xml.new
mv /usr/share/mime/packages/freedesktop.org.xml /usr/share/mime/packages/freedesktop.org.xml.original
mv /usr/share/mime/packages/freedesktop.org.xml.new /usr/share/mime/packages/freedesktop.org.xml
echo "File updated successfully!";
echo "Update mime database...";
update-mime-database /usr/share/mime
echo "Mime database updated successfully! ALL DONE!";

Solution 2:

note that this is an addition to Arthur Shipkowski's answer, https://superuser.com/a/775669/238284

if you don't have root access and/or want a workaround without messing with the internal system, you can just make a file and place it in ~/.local/share/mime/packages/.

  1. make a file in ~/.local/share/mime/packages/, you can name it anything you want as long as it ends with .xml but i recommend naming it x-shockwave-flash.xml
  2. open the file, copy and paste (or manually type) the code below then save the file
  3. run update-mime-datebase ~/.local/share/mime

x-shockwave-flash.xml: <?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="application/x-shockwave-flash"> <comment>Shockwave Flash file</comment> <comment xml:lang="ar">ملف Shockwave Flash</comment> <comment xml:lang="be@latin">Fajł Shockwave Flash</comment> <comment xml:lang="bg">Файл — Shockwave Flash</comment> <comment xml:lang="ca">fitxer Shockwave Flash</comment> <comment xml:lang="cs">Soubor Shockwave Flash</comment> <comment xml:lang="da">Shockwave Flash-fil</comment> <comment xml:lang="de">Shockwave-Flash-Datei</comment> <comment xml:lang="el">αρχείο Shockwave Flash</comment> <comment xml:lang="en_GB">Shockwave Flash file</comment> <comment xml:lang="eo">dosiero de Shockwave Flash</comment> <comment xml:lang="es">archivo Shockwave Flash</comment> <comment xml:lang="eu">Shockwave Flash fitxategia</comment> <comment xml:lang="fi">Shockwave Flash -tiedosto</comment> <comment xml:lang="fo">Shockwave Flash fíla</comment> <comment xml:lang="fr">fichier Shockwave Flash</comment> <comment xml:lang="ga">comhad Shockwave Flash</comment> <comment xml:lang="gl">ficheiro sockwave Flash</comment> <comment xml:lang="he">קובץ של Shockwave Flash</comment> <comment xml:lang="hr">Shockwave Flash datoteka</comment> <comment xml:lang="hu">Shockwave Flash-fájl</comment> <comment xml:lang="id">Berkas Shockwave Flash</comment> <comment xml:lang="it">File Shockwave Flash</comment> <comment xml:lang="ja">Shockwave Flash ファイル</comment> <comment xml:lang="kk">Shockwave Flash файлы</comment> <comment xml:lang="ko">Shockwave 플래시 파일</comment> <comment xml:lang="lt">Shockwave Flash failas</comment> <comment xml:lang="lv">Shockwave Flash datne</comment> <comment xml:lang="ms">Fail Shockwave Flash</comment> <comment xml:lang="nb">Shockwave Flash-fil</comment> <comment xml:lang="nl">Shockwave Flash-bestand</comment> <comment xml:lang="nn">Shockwave Flash-fil</comment> <comment xml:lang="pl">Plik Shockwave Flash</comment> <comment xml:lang="pt">ficheiro Shockwave Flash</comment> <comment xml:lang="pt_BR">Arquivo Shockwave Flash</comment> <comment xml:lang="ro">Fișier Shockwave Flash</comment> <comment xml:lang="ru">файл Shockwave Flash</comment> <comment xml:lang="sk">Súbor Shockwave Flash</comment> <comment xml:lang="sl">Datoteka Shockwave Flash</comment> <comment xml:lang="sq">File Flash Shockwave</comment> <comment xml:lang="sr">Шоквејв Флеш датотека</comment> <comment xml:lang="sv">Shockwave Flash-fil</comment> <comment xml:lang="uk">файл Shockwave Flash</comment> <comment xml:lang="vi">Tập tin Flash Shockwave</comment> <comment xml:lang="zh_CN">Shockwave Flash 文件</comment> <comment xml:lang="zh_TW">Shockwave Flash 檔</comment> <alias type="application/vnd.adobe.flash.movie"/> <alias type="application/futuresplash"/> <generic-icon name="video-x-generic"/> <magic priority="50"> <match value="FWS" type="string" offset="0"/> <match value="CWS" type="string" offset="0"/> </magic> <glob pattern="*.swf"/> <glob pattern="*.spl"/> </mime-type> </mime-info>