QWebEngineView - 允许在浏览器中本地存储
QWebEngineView - Allow local Store in the Browser
我正在尝试实现一个网络浏览器来查看网页 'https://earth.google.com/web'。
浏览器工作正常。
浏览器保存了我的 google 用户,所以当我开始一个新的会话时,我不必输入我的 google 用户来使用我的设置。
当我上传 KML 轨道时出现问题,程序显示“要保存此文件,请在浏览器中启用本地存储。
在 Python 控制台中我看到这条消息:
js: 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.
如果未保存曲目,当我开始新的会话时,KML 不存在。
我试试这个:
# Creation of Widget
self.web_view = QWebEngineView()
# Setting the Browser
settings = QWebEngineSettings.globalSettings()
# Setting Local Storage
settings.setAttribute(QWebEngineSettings.LocalStorageEnabled, True)
# Other settings I tried:
settings.setAttribute(QWebEngineSettings.JavascriptCanAccessClipboard, True)
settings.setAttribute(QWebEngineSettings.PluginsEnabled, True)
settings.setAttribute(QWebEngineSettings.FullScreenSupportEnabled, True)
settings.setAttribute(QWebEngineSettings.ScreenCaptureEnabled, True)
settings.setAttribute(QWebEngineSettings.AllowGeolocationOnInsecureOrigins, True)
settings.setAttribute(QWebEngineSettings.JavascriptCanPaste, True)
不需要启用QWebEngineSettings::LocalStorageEnabled
since they are enabled by default but you have to accept the QWebEngineQuotaRequest
associated with the quotaRequested
信号等属性:
self.web_view.page().quotaRequested.connect(lambda request: request.accept())
我正在尝试实现一个网络浏览器来查看网页 'https://earth.google.com/web'。 浏览器工作正常。 浏览器保存了我的 google 用户,所以当我开始一个新的会话时,我不必输入我的 google 用户来使用我的设置。 当我上传 KML 轨道时出现问题,程序显示“要保存此文件,请在浏览器中启用本地存储。
在 Python 控制台中我看到这条消息:
js: 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.
如果未保存曲目,当我开始新的会话时,KML 不存在。
我试试这个:
# Creation of Widget
self.web_view = QWebEngineView()
# Setting the Browser
settings = QWebEngineSettings.globalSettings()
# Setting Local Storage
settings.setAttribute(QWebEngineSettings.LocalStorageEnabled, True)
# Other settings I tried:
settings.setAttribute(QWebEngineSettings.JavascriptCanAccessClipboard, True)
settings.setAttribute(QWebEngineSettings.PluginsEnabled, True)
settings.setAttribute(QWebEngineSettings.FullScreenSupportEnabled, True)
settings.setAttribute(QWebEngineSettings.ScreenCaptureEnabled, True)
settings.setAttribute(QWebEngineSettings.AllowGeolocationOnInsecureOrigins, True)
settings.setAttribute(QWebEngineSettings.JavascriptCanPaste, True)
不需要启用QWebEngineSettings::LocalStorageEnabled
since they are enabled by default but you have to accept the QWebEngineQuotaRequest
associated with the quotaRequested
信号等属性:
self.web_view.page().quotaRequested.connect(lambda request: request.accept())