title: Getting log output from Qt 5 WebView?
body: <p>I'm trying to get the console log output from a Qt 5 WebView web page, but I cannot find out how to do it.
  Maybe some out you out there can help me?</p>
  
  <p>I have tried to enable the web inspector that is supposed to show up when you right click the web page, but nothing happens when I do that. I have set up an inspector port (on 1111) by setting the environment variable  QTWEBKIT_INSPECTOR_SERVER to 1111. And I am able to get a page that has this on it:</p>
  
  <pre><code>Inspectable web views
  
  LOG TEST [http://MY_LAN_IP:8880/logtest.html]
  </code></pre>
  
  <p>But when I click the link I get this error: </p>
  
  <pre><code>WebSocket connection to 'ws://localhost:1111/devtools/page/1' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received
  inspector.js:341 Event {clipboardData: undefined, path: NodeList[0], cancelBubble: false, returnValue: true, srcElement: WebSocket…}
  View.js:363 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
  </code></pre>
  
  <p>For demo purposes I have a web page on a local web server that looks like this:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;LOG TEST&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Logging to console...&lt;/h1&gt;
          &lt;script&gt;
              setInterval(function() {
                  console.log("This is a log message");
                  console.error("This is an error message");
              }, 1000);
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The QML file looks like this:</p>
  
  <pre><code>import QtQuick 2.2
  import QtQuick.Window 2.1
  import QtWebKit 3.0
  import QtWebKit.experimental 1.0
  
  Window {
      visible: true
      width: 360
      height: 360
  
      WebView {
          url: "http://MY_LAN_IP:8880/logtest.html"
          anchors.fill: parent
          experimental.preferences.developerExtrasEnabled: true
          experimental.preferences.navigatorQtObjectEnabled: false
  
      }
  }
  </code></pre>