5

I have QtWebkit ported on Arm based platform. We are able to run QtTestBrowser. I wanted to disable "same-origin-policy" in the above browser.

Please let me know if any body has idea on this.

hari
  • 1,419
  • 4
  • 19
  • 30

2 Answers2

3

I know this is old, but you can do this by modifying the QWebPage's settings:

auto settings = page.settings();
settings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls,true);
settings->setAttribute(QWebSettings::LocalContentCanAccessFileUrls,true);
Tim Finer
  • 565
  • 6
  • 13
  • 1
    Yes, what you have said is correct. But if a remote need to access a local file ; For example, a local JS (file://) file or one domain access other (Not through AJAX ) I need to specify, what is allowed ; a whitelist. This will be highly insecure. But that was my "requirement" :). – hari Jan 10 '13 at 06:53
0

By default, Qt doesn't expose method to disable / whitelist the same origin policy. Extended the same (qwebsecurityorigin.cpp) and able to get it working.

hari
  • 1,419
  • 4
  • 19
  • 30