[Qtwebengine] Any way to disable same-origin policy?
Kevin Truong
knt261 at gmail.com
Thu Nov 19 22:49:37 CET 2015
Thank you for the responses! The issue is fixed now.
On Tue, Nov 17, 2015 at 8:29 PM, davidsz <davidsz at inf.u-szeged.hu> wrote:
> Hi Kevin,
>
> have you tried to pass "--disable-web-security" argument to your
> QApplication? It delegates the command line switches to the Chromium
> backend, so basically it should work.
>
> Best regards,
> Szabolcs
Szabolcs -- yes! That works. I'm new to Qt and did not know we can do such
a thing, but same origin policy is now disabled :)
On Wed, Nov 18, 2015 at 12:21 AM, Koehne Kai <Kai.Koehne at theqtcompany.com>
wrote:
>
> Maybe you can try out the QWebEngineScript api. This allows you
> To explicitly set whether you want to run on sub frames, or not:
>
> http://doc.qt.io/qt-5/qwebenginescript.html#setRunsOnSubFrames
>
> If that ain't help either, this is IMO a bug. Please create a request on
> bugreports.qt.io
>
> Regards
>
> Kai
>
Kai -- Although my issue is fixed, I'm still curious to try out your
method. How do I use QWebEngineScript with the QWebEnginePage object that I
have? For example, I tried to add the following code right after calling
m_page->runJavascript(m_script):
QWebEngineScriptCollection* scripts = &m_page->scripts();
QList<QWebEngineScript> scriptsList = scripts->toList();
for (int i = 0; i < scriptsList.size(); i++) {
QWebEngineScript script = scriptsList.at(i);
script.setRunsOnSubFrames(true);
}
But it doesn't seem to work (maybe the javascript is already finished
running before I was able to iterate through all the script source and
set runsOnSubFrames to true). Mind if you point me to the right
direction/documentation?
Best,
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20151119/28c74b70/attachment.html>
More information about the QtWebEngine
mailing list