Important: Please read the Qt Code of Conduct -

[Qt 5.3] Replacing the window JS object or trace member access

  • Hi all,

    currently I'm doing some deep dive into the webkit javascript bridge. For some research work I want to be able to register if a webpage accesses members of the javascript window object.

    My first attemp was to replace the entire window object with a QObject derived implementation. But this seems not to work using QWebFrame::addToJavaScriptWindowObject if I set the name to "window". If I set the name to "window2" it works - so I think it's simply not possible to overwrite the window object.

    Now if I dig deeper to QtWebKit, do you have any pointers for me where I can start looking for a place where I can maybe modify the default window object implementation? Any suggestions are welcome :-)


  • I figured out I can hook up in the WebKit class DOMWindow (e. g. DOMWindow::outerHeight() which is window.outerHeight property in JS).

    I now try to figure out how to connect a slot of my class to a signal emitted in outerHeight(). Is there a good way to access the instance of DOMWindowf for the current page? Again, any suggestions are welcome :-)

  • Tried use "QWebFrame::evaluateScript" ?

Log in to reply