我正在开发一个 CEFPython 应用程序,该应用程序需要我包含一些外部文件,例如 JS 或 CSS 库。但是 HTML 文件中提到的任何外部路径(指同一文件夹中存在的外部库和在线资源 URL)似乎是不可接受,我确定缺少一个启用外部文件喜欢的标志,但无法弄清楚是哪个。下面是我的主要功能的代码:
def main():
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
# To change user agent use either "product_version"
# or "user_agent" options. Explained in Tutorial in
# "Change user agent string" section.
settings = {
# "web_security_disabled": True,
# "user_agent": "MyAgent/20.00 MyProduct/10.00",
}
cef.Initialize(settings=settings)
browser = cef.CreateBrowserSync(url=html_to_data_uri(HTML_code),
window_title="Demo Program")
set_javascript_bindings(browser)
cef.MessageLoop()
cef.Shutdown()