【问题标题】:How to disable web security (cross origin reequest) in webkit gtk如何在 webkit gtk 中禁用网络安全(跨源请求)
【发布时间】:2012-06-28 20:16:56
【问题描述】:

我正在尝试为一些网站编写一个特定于网站的浏览器,但遇到了 webkitgtk 的问题。 WebKitGtk 会阻止一些跨域请求作为安全措施,并且无法在 WebKitGtk API 中禁用它

Python 简单示例

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()

输出:

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

【问题讨论】:

    标签: python webkit gtk pygobject


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      似乎与我相关的唯一设置是enable-xss-auditor

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

      【讨论】:

      • 我一直在尝试为自己的实现解决这个问题,虽然 WebKit 本身可以选择禁用网络安全 (Settings::setWebSecurityEnabled),但它不会暴露给 GTK+ API。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-16
      • 2015-08-28
      • 2019-11-25
      • 2013-02-14
      • 2015-12-18
      • 1970-01-01
      • 2019-06-21
      相关资源
      最近更新 更多