如何在cefpython中禁用同源策略?

问题描述

我想在使用 cefpython禁用 pywebview 中的 same-origin policy。我根据 this page 尝试了以下代码:

from webview.platforms.cef import command_line_switches

command_line_switches.update({
     'disable_web_security': 'True' }) # if i try to put a bool as value,it shows expected bytes,not bool

if __name__ == "__main__":
   webview.create_window('',url='http://localhost:5000/')
   webview.start(gui='cef')

但这似乎并没有解决问题。我有一个不同来源的 iframe,我想在其中触发点击事件。如果启用了安全性,那么它会抛出一个带有同源策略消息的错误。我错过了什么吗?我该如何解决这个问题?

解决方法

Cefpython browser settings

即使使用 cef 进行调试也无法正常工作,我什至无法在不启动本地服务器的情况下在 pywebview 中加载图像!!!我会切换到pyqt

更新

这是服务器端安全,而不是浏览器安全!

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...