Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Unsolved How to stifle messages like "A Parser-blocking, cross-origin script..."

    QtWebEngine
    1
    2
    608
    Loading More Posts
    • 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.
    • D
      dcortesi last edited by

      I have a basic PyQt5 app that uses QWebEnginePage to display selected web URLs, which often have advertisements on them. Some of these ads cause QWebEngine to log console messages of the form,

      A Parser-blocking, cross-origin script, http://ads.thehiveworks.com/delivery/spc.php?zones=245|246|387&source=&r=29650133&charset=UTF-8&loc=http%3A//sssscomic.com/comic.php, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity. See https://www.chromestatus.com/feature/5718547946799104 for more details.

      (n.b. the chromestatus url explains how the designer of the loaded page is doing things wrong -- but I have no control over that!)

      These console messages are annoying and unhelpful to the user and I want to make them stop. I tried making a custom QWebEnginePage class with an override of javaScriptConsoleMessage(). This revealed that although the messages are delivered to that method, they are ALSO printed to the real console first before the method is called!

      I can't find how to control the Qt Logging framework to make it ignore javaScript log messages. Any suggestions welcome!

      1 Reply Last reply Reply Quote 0
      • D
        dcortesi last edited by

        As a work-around (not a solution) the user is doing the following:

        python the_qt_script.py > /dev/null 2>&1
        

        It is necessary to use "2>&1" to force stderr into /dev/null before these many annoying messages disappear. Of course, it is possible that meaningful messages are also being discarded! So, control of the Java Console output is still needed.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post