← Back to team overview

ubuntu-phone team mailing list archive

Re: [Interest] How to reset QML WebView?

 

On Tue, Jun 3, 2014 at 6:28 PM, Николай Шатохин <n.shatokhin@xxxxxxxxx>
wrote:

> import QtQuick 2.0
> import QtWebKit 3.0
> import QtWebKit.experimental 1.0
>
> Item {
>     width: 640
>     height: 480
>
>     signal closeWindow();
>
>     WebView
>     {
>         anchors.fill: parent
>         url: address
>         experimental.preferences.privateBrowsingEnabled: true
>     }
> }
>
>
> 2014-06-03 19:27 GMT+03:00 Николай Шатохин <n.shatokhin@xxxxxxxxx>:
>
> I just tried it. Not working.
>>
>
Indeed, I tested the example you linked, adding
"experimental.preferences.privateBrowsingEnabled: true" to the webview, and
it doesn’t work.

Even deleting $HOME/.local/share/webview_test/.QtWebKit (which is where the
cookies are persistently stored) in between doesn’t help.

It’s as if the cookie database was kept around in memory, despite the
webview being destroyed (and the privateBrowsingEnabled preference is not
being respected).

Those look like bugs in QtWebKit which should be reported upstream.

Note that if your app is targetting Ubuntu specifically, you might want to
give a go at the UbuntuWebView API instead:

  import QtQuick 2.0
  import Ubuntu.Components.Extras.Browser 0.2

  UbuntuWebView {
    incognito: true
  }

I just tested it here, and it works as expected (i.e. the second time
around the user is not logged in).

HTH,

 Olivier

References