How to disable web security (cross origin reequest) in webkit gtk

三世轮回 提交于 2019-12-11 07:54:52

问题


I'm trying to write a site specific browser for a few sites and am facing an issue with webkitgtk. WebKitGtk blocks some cross domain request as a security measure and there is no way to disable it in the WebKitGtk API

Python simple example

from gi.repository import Gtk, WebKit
window = Gtk.Window()
webview = WebKit.WebView()
webview.load_uri('http://drive.google.com')
window.add(webview)
window.show_all()
Gtk.main()

Output:

  ** Message: console message:  @0: Unable to post message to https://0.drive.google.com. Recipient has origin https://drive.google.com.

回答1:


Not possible as of now. Bug: https://bugs.webkit.org/show_bug.cgi?id=58378




回答2:


The only setting that appears relevant to me is enable-xss-auditor:

settings = WebKit.WebSettings()
settings.set_property('enable-xss-auditor', False)
webview.set_settings(settings)


来源:https://stackoverflow.com/questions/11252206/how-to-disable-web-security-cross-origin-reequest-in-webkit-gtk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!