赞助

CEF 跨域访问iframe

转载:https://www.cnblogs.com/wxxweb/p/3738696.html

 

在CefBrowserSettings也就是_cef_browser_settings_t结构体中,有个成员变量web_security,来看下它的注释

///
  // Controls whether web security restrictions (same-origin policy) will be
  // enforced. Disabling this setting is not recommend as it will allow risky
  // security behavior such as cross-site scripting (XSS). Also configurable
  // using the "disable-web-security" command-line switch.
  ///
  cef_state_t web_security;

方法1. 将其赋值为true,即可运行跨域访问

方法2. 命令行设置

command_line->AppendSwitch("--disable-web-security");//关闭同源策略

 

posted @ 2019-01-18 17:46  车臣  阅读(2035)  评论(0编辑  收藏  举报