Unsolved How to open degraded version of chrome or firefox within Qt application
-
I am using Qt 5.15.0, which uses chromium 80 version. I have an external HTML file which uses java applets and I need to view it in our Qt application. Chromium has disabled java from 42 version onwards. So webengineview will not work for me to display HTML file. There are two solutions available to me -
- Use degraded version of chrome (42) and install java plugin to it.
- Use degraded version of firefox (38.04) and install java plugin to it.
Is there a way to open firefox or degraded chromium inside Qt application?
Thanks -
@Ryna said in How to open degraded version of chrome or firefox within Qt application:
Is there a way to open firefox or degraded chromium inside Qt application?
No. You'll need to install an older version of Qt which contains the older version of Chromium. See https://wiki.qt.io/QtWebEngine/ChromiumVersions
However, make sure you understand the security implications of using an outdated web engine. Don't put your users at risk.
-
@JKSH Thanks for your reply. I just got one hint with which we are able to degrade chrome version in latest version of Qt -
QWebEngineView* web = new QWebEngineView(); QWebEngineProfile *profile = new QWebEngineProfile(); profile->setHttpUserAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64)" "AppleWebKit/537.36 (KHTML, like Gecko)" "Chrome/38.0.3809.132 Safari/537.36"); QWebEnginePage *page = new QWebEnginePage(profile, web); web->setPage(page); web->load(QUrl("https://www.google.co.in/")); web->show(); QString version; QString user_agent = profile->httpUserAgent(); for(const QString & text : user_agent.split(" ")){ if(text.startsWith(QStringLiteral("Chrome/"))){ version = text.mid(QStringLiteral("Chrome/").length()); } } qDebug().noquote()<< "Qt version:" << QT_VERSION_STR << "chromium version:" << version;
Debug shows "Qt version: 5.15.0 chromium version: 38.0.3809.132" now
So, with this code I was able to degrade chrome version even in Qt 5.15.0 to chrome 38 version. I am exploring more if we can get any issues while using this approach. I am still not sure if whatever I am doing this way is right or not. Now pending would be to install icedtea plugin.
About user's risk, it's an old internal application which cannot be removed/upgraded so we have no option left except loading it. I appreciate that you mentioned the concern. Thanks
-
@Ryna That just sets the user agent string, and then parses out the contents of the string you just set. It doesn't change the actual version of chromium in any way, or change the behavior of chromium. You can set the user agent string to "I like puppies and ice cream 12345" if you want.
Building a C++ app to run an HTML renderer to run a Java applet seems like a weirdly indirect choice. If you just install the Java dev tools, you can probably directly run the java applet. If your goal is just to run the Java applet... just run the java applet. https://docs.oracle.com/javase/7/docs/technotes/tools/windows/appletviewer.html