RBenet
RBenet

Reputation: 211

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.

enter image description here

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) 

Upvotes: 2

Views: 784

Answers (1)

eyllanesc
eyllanesc

Reputation: 243955

It is not necessary to enable attributes such as QWebEngineSettings::LocalStorageEnabled since they are enabled by default but you have to accept the QWebEngineQuotaRequest associated with the quotaRequested signal:

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

Upvotes: 2

Related Questions