简体   繁体   English

Qt5 WebKit未检测到NPAPI插件

[英]Qt5 WebKit not detecting NPAPI plugin

#include "mainwindow.h"
#include <QApplication>
#include <QtWebKit>
#include <QWebView>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QWebView *view = new QWebView();
    QWebSettings::PluginsEnabled;
    view->load(QUrl("http://www.paulirish.com/demo/multi"));

    view->show();

    return a.exec();
}

I am trying to load a plugin in QtWebkit Webview but it isnt being loaded. 我正在尝试在QtWebkit Webview中加载插件,但未加载。 I couldnt find the right path as mentioned Here , but it isnt loading. 我找不到这里提到的正确路径,但是它没有加载。 I have added Env. 我添加了环境。 Variable QTWEBKIT_PLUGIN_PATH to System Variable & MOZ_PLUGIN_PATH was already in user variable, added by Foxit Reader. Foxit Reader添加的用户变量中已经存在系统变量&MOZ_PLUGIN_PATH的变量QTWEBKIT_PLUGIN_PATH。 I tried placing the plugin dll file on both the directories corresponding to the Env. 我尝试将插件dll文件放在与Env对应的两个目录中。 Variables but it isnt loading the plugin. 变量,但不加载插件。 After i palced the plugin in Moz_plugin_path, firefox was able to detect the plugin. 在将插件放在Moz_plugin_path中之后,firefox能够检测到该插件。

As for enabling the plugin in QTWebview i have tried using 至于在QTWebview中启用插件,我尝试使用

QWebSettings::PluginsEnabled; QWebSettings :: PluginsEnabled;

QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled,true); QWebSettings :: globalSettings() - >的setAttribute(QWebSettings :: PluginsEnabled,真正的);

view->page()->settings()->PluginsEnabled; 查看 - >页面() - >设置() - > PluginsEnabled;

but found success with none of them, I am using Windows 8.1 and Qt 5.2 但是都没有成功,我正在使用Windows 8.1和Qt 5.2

You should set the QWebSettings::PluginsEnabled attribute. 您应该设置QWebSettings::PluginsEnabled属性。 The way you are doing it, nothing is happening. 您的操作方式没有任何反应。

Enable the attribute with the following code: 使用以下代码启用属性:

QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);

Put this before your QWebView creation. 将其放在QWebView创建之前。

Refer to the documentation for more details: 请参阅文档以获取更多详细信息:

QWebSettings Docs QWebSettings文件

i have been through exactly the same situation. 我经历过完全相同的情况。 what solved my problem was to install adobe flash player plugin for NPAPI. 解决我问题的是为NPAPI安装Adobe Flash Player插件。 Modern web browsers like Google Chrome and Firefox are often distributed with builtin flash player plugin. 像Google Chrome和Firefox这样的现代网络浏览器通常使用内置的Flash Player插件进行分发。 So Chrome/Firefox works well does not ensure that you have the proper flash plugin installed properly systemwide, which is needed by Qt5WebKit to enable local plugin support for Flash content. 因此,Chrome / Firefox运作良好不会确保您在系统范围内正确安装了正确的Flash插件,而Qt5WebKit需要启用该插件才能为Flash内容启用本地插件支持。

so, make sure the adobe flash player plugin for NPAPI is installed, and hope it would solve your problem. 因此,请确保已安装用于NPAPI的Adobe Flash Player插件,并希望它能够解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM