Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QWebEngineScript execution order
Forum Updated to NodeBB v4.3 + New Features

QWebEngineScript execution order

Scheduled Pinned Locked Moved Solved QtWebEngine
3 Posts 1 Posters 473 Views
  • 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.
  • C Offline
    C Offline
    Curve
    wrote on 10 Nov 2021, 21:42 last edited by Curve 11 Oct 2021, 22:19
    #1

    Is the order in which the QWebEngineScripts that are added to the QWebEngineScriptCollection &QWebEnginePage::scripts() execute always the same?

    I have two scripts added to the list and they seemingly get executed in random order, is there any way to enforce the order in which the scripts get executed?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Curve
      wrote on 10 Nov 2021, 22:15 last edited by Curve 11 Oct 2021, 22:20
      #2

      I just read through this page: https://wiki.qt.io/QtWebEngine/ScriptsAndExtensions

      And it states that

      Second, the scripts are executed in an undefined, essentially pseudo-random, order

      Which clears it up!

      Although I'd be interested in why this is the case as Windows' WebView2 seems to follow the order in which the scripts were added to their injection list.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Curve
        wrote on 11 Nov 2021, 17:24 last edited by
        #3

        I found a workaround for this, it isn't the best but I'll explain it for those interested:

        You register only one script to be executed for each injection-point, you then assign that script a specific name.
        If you want to inject another script you then search the script in the page script-collection, remove it from the list, append the new script code to the previous script and then insert it back into the list

        1 Reply Last reply
        2

        1/3

        10 Nov 2021, 21:42

        • Login

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