轉載: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");//關閉同源策略
