Firefox 尝试下载本地 .swf 文件

Firefox 尝试下载本地 .swf 文件

我对我的 Firefox 和 Flash 文件非常恼火:

当我尝试.swf用它打开一个文件时:

  • 如果文件在网络上(通过http://...),它可以在浏览器中正常播放
  • 如果文件是本地的(通过file:///...),firefox 只会显示一个对话框来下载它

它尝试打开一个 web swf 文件,下载它,然后在本地打开它,结果是一样的。所以我猜这是 Firefox 的问题。

我使用的是 Gentoo Linux,它今天启动了,没有任何明显的原因。

答案1

经过一番深入研究,我发现这是一个 MIME 类型问题。如果 Linux 上的 Firefox(或 Chrome)认为类型为 application/vnd.adobe.flash.movi​​e,它将不会播放 SWF 文件。

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

以 root 身份编辑 /usr/share/mime/packages/freedesktop.org.xml 并替换以下内容:

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

和:

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

然后运行:

update-mime-database /usr/share/mime

我发现我需要重启 Firefox。下面是一个与http://ubuntuforums.org/showthread.php?t=2218732&page=2执行这些步骤(使用 sudo 运行),但我要警告你——我注意到不同的安装似乎有不同的间距,这可能会使 sed 脚本出错,这就是发生在我身上的事情。

#!/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!";

答案2

请注意,这是对 Arthur Shipkowski 的回答的补充,https://superuser.com/a/775669/238284

如果您没有 root 权限和/或想要一种不干扰内部系统的解决方案,您可以创建一个文件并将其放入~/.local/share/mime/packages/

  1. 创建一个文件~/.local/share/mime/packages/,你可以给它起任何名字,只要它以 结尾,.xml但我建议将它命名为x-shockwave-flash.xml
  2. 打开文件,复制并粘贴(或手动输入)以下代码,然后保存文件
  3. 跑步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>

答案3

这显然是 Firefox 某些版本的问题,因为我在升级到版本 25 和 26 之间后也遇到了同样的行为变化。

我使用过 Debian,问题出在系统配置中的 MIME 定义变化。Firefox 似乎不符合这些变化。

在更新到当时的最新版本 Firefox(版本 28)之后,问题得到解决,file://协议中的 SWF 文件可以像以前一样正常打开。

相关内容