简体   繁体   中英

QWebEngineView - Allow local Store in the Browser

I'm trying to implement a web browser to see the web page 'https://earth.google.com/web' . The browser works fine. The browser save my google user, so when I start a new sesion, I don't have to put my google user, for using my settings. My problem occurs when I upload a KML track, the program says 'To save this file, enable local store in the browser.

在此处输入图片说明

In Python console I saw this message:

js: 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.

If the track is not saved, when I start a new sesion, the KML is not there.

I try this this:

# 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因为它们是默认启用的,但你必须接受QWebEngineQuotaRequest与关联quotaRequested信号:

self.web_view.page().quotaRequested.connect(lambda request: request.accept())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM