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. How to stifle messages like "A Parser-blocking, cross-origin script..."
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved QtWebEngine
2 Posts 1 Posters 774 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.
  • D Offline
    D Offline
    dcortesi
    wrote on 2 Oct 2017, 00:17 last edited by
    #1

    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
    0
    • D Offline
      D Offline
      dcortesi
      wrote on 2 Oct 2017, 15:49 last edited by
      #2

      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
      0

      1/2

      2 Oct 2017, 00:17

      • Login

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