一、安装FireFox

1、Firefox必须安装52以下版本,附件中有50版本,安装的时候把网络断开,否则会自动升级到最新版本。安装好后,在设置里面关闭自动升级。

2、如果电脑中没有msvc2015运行库,安装附件中的vcredist_msvc2015_x86.exe

二、安装插件

1、插件位置在Qt\bin\npqtplugintest.dll。

2、在注册表如下位置

64位操作系统:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MozillaPlugins

32位操作系统:

HKEY_LOCAL_MACHINE\SOFTWARE\MozillaPlugins

添加项@qtplugins/calc,名称随便起

然后添加字符串属性Path,值为npqtplugintest.dll的绝对路径,可参考

3、将Qt\bin的绝对路径添加到系统路径Path下面

3、创建环境变量QT_PLUGIN_PATH将Qt\bin的绝对路径加上

  • 三、测试插件

  1. 打开firefox,在地址栏输入about:plugins,如果能看到

说明插件安装成功。

2、使用Firefox打开Qt\bin\计算.html

得到如下结果测试成功

  • 四、程序源码

  1. 程序使用msvc2015(x86)debug编译
  2. Qt版本为qt-opensource-windows-x86-5.10.1.exe

3、源码在Qt\qtbrowserplugin-calc下存放,qtcreator工程文件是Qt\qtbrowserplugin-calc\qtplugintest\qtplugintest.pro

  • 五、Firefox怎么查到插件(参考)

When a Gecko-based browser starts up, it checks certain directories for plug-ins, in this order:

Windows

Directory pointed to by MOZ_PLUGIN_PATH environment variable.

%APPDATA%\Mozilla\plugins, where %APPDATA% denotes per-user Application Data directory.

Plug-ins within toolkit bundles.

Profile directory\plugins, where Profile directory is a user profile directory.

Directories pointed to by HKEY_CURRENT_USER\Software\MozillaPlugins\*\Pathregistry value, where * can be replaced by any name.

Directories pointed to by HKEY_LOCAL_MACHINE\Software\MozillaPlugins\*\Pathregistry value, where * can be replaced by any name.

Mac OS X

~/Library/Internet Plug-Ins.

/Library/Internet Plug-Ins.

/System/Library/Frameworks/JavaVM.framework/Versions/Current/Resources.

Plug-ins within toolkit bundles.

Profile directory/plugins, where Profile directory is a user profile directory.

Linux

Directory pointed to by MOZ_PLUGIN_PATH environment variable. For example:

#!/bin/bash

 

export MOZ_PLUGIN_PATH=/usr/lib64/mozilla/plugins

exec /usr/lib64/firefox/firefox

Profile directory/plugins, where Profile directory is the directory of the current user profile.

~/.mozilla/plugins.

/usr/lib/mozilla/plugins (the 64-bit Firefox checks /usr/lib64/mozilla/plugins as well).

/usr/lib64/firefox/plugins (for 64-bit Firefox)

Note: Firefox Nightly checks a subset of these locations. Also some Linux distributions provide a system browser configured differently.

  • 六、Firefox在52版本以后就不再支持npapi

相关文章: