Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to open degraded version of chrome or firefox within Qt application
Forum Updated to NodeBB v4.3 + New Features

How to open degraded version of chrome or firefox within Qt application

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 751 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ryna
    wrote on last edited by
    #1

    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 -

    1. Use degraded version of chrome (42) and install java plugin to it.
    2. 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

    JKSHJ 1 Reply Last reply
    0
    • R Ryna

      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 -

      1. Use degraded version of chrome (42) and install java plugin to it.
      2. 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

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by JKSH
      #2

      @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.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      R 1 Reply Last reply
      3
      • JKSHJ JKSH

        @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.

        R Offline
        R Offline
        Ryna
        wrote on last edited by
        #3

        @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

        W 1 Reply Last reply
        0
        • R Ryna

          @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

          W Offline
          W Offline
          wrosecrans
          wrote on last edited by
          #4

          @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

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved