[Qtwebengine] Any way to disable same-origin policy?

Koehne Kai Kai.Koehne at theqtcompany.com
Sat Nov 21 10:20:28 CET 2015



> -----Urspr√ľngliche Nachricht-----
> Von: Kevin Truong [mailto:knt261 at gmail.com]
> Gesendet: Freitag, 20. November 2015 23:54
> An: Koehne Kai <Kai.Koehne at theqtcompany.com>
> Cc: qtwebengine at qt-project.org
> Betreff: Re: [Qtwebengine] Any way to disable same-origin policy?
> 
> Thanks Kai, that was helpful! I would actually prefer to use this method if I
> can better control when to execute the script -- it seems like the injection
> points are very limited, tied to certain document events.

It's true that the injection points are limited. That doesn't mean that you can't hook up things in your injected code though so that things are executed at the right time:

If you want to execute JavaScript triggered by events in the page itself you can use the standard hooks to do so.

If you want to execute JavaScript triggered by events in your C++ application, you can set up a QWebChannel has a bi-directional communication channel. You can expose a Q_OBJECT in this channel, and then hook up JavaScript methods as soon as a signal is emitted/a value in the object is changed.

Hope this helps,

Kai



More information about the QtWebEngine mailing list