Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-54107

javascript side lose qt object when refresh or open new page

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: 5.7.0 RC
    • Fix Version/s: None
    • Component/s: WebEngine
    • Labels:
      None
    • Environment:
      win10, 5.7 RC

      Description

      Can reproduce by following steps:

      1: load qwebchannel.js into web page.
      2: then add these JavaScript code into web page:

       new QWebChannel(qt.webChannelTransport, function(channel) {  etc..  }); 

      3. add c++ code into webpage constructor (webpage derived from QWebEnginePage) :

      QWebChannel *channel = new QWebChannel(this);
          channel->registerObject(QStringLiteral("WebExtensionWin10"), &m_content);
          setWebChannel(channel);
          

      It's work fine when first load web page. The developer tools display "qt is not defined(…)" when reload page or open newpage. so in the case we cannot access c++ object.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qt_webengine_team Qt WebEngine Team
            Reporter:
            vidarxu Carter Davies
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes