python webbrowser模块和file://协议查询字符串
我有一个使用铬嵌入式框架的应用程序。 作为CEF不可用的设置的替代方法(例如,Python 3.10+),我想退缩到WebBrowser来启动本地WebApp。
由于没有CEF,我没有任何挂钩将数据传递到WebApp,因此我尝试通过GET参数传递配置字符串。我不知道为什么,但是当我将一个与文件一起使用时,查询字符串消失了://协议
示例:
webbrowser.open_new_tab('https://google.com?foo=bar') # this works.
webbrowser.open_new_tab('file:///c:/some/dir/somefile.html?foo=bar') # this doesn't works.
在第二个示例上。打开浏览器窗口,地址栏中的URL是file> file> file> file>://some/dir/somefile.html
有什么想法吗?
I have an application that uses Chromium Embedded Framework.
As an alternative for a setup where CEF is not usable (Python 3.10+ for example), I would like to fallback to a webbrowser to launch a local webapp.
Since I don't have any hook to pass data to the webapp without CEF, I tried to pass a configuration string through a GET parameter. I don't know why, but the query string disappears when I use one with the file:// protocol
example :
webbrowser.open_new_tab('https://google.com?foo=bar') # this works.
webbrowser.open_new_tab('file:///c:/some/dir/somefile.html?foo=bar') # this doesn't works.
on the second example. A browser window is open and the URL in the address bar is file:///c:/some/dir/somefile.html
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论