← Back to team overview

ubuntu-phone team mailing list archive

Re: How to reset QML WebView?

 

On Mon, Jun 2, 2014 at 7:59 PM, Николай Шатохин <n.shatokhin@xxxxxxxxx>
wrote:

> Hello.
>
> I have a web browser's window maked by QML from WebView.
>
> And in C++ I create window:
>
> if(_socialWindow == NULL)
>     {
>         _socialWindow= new QQuickView();
>         _socialWindow->setFlags(Qt::Tool);
>         _socialWindow->setResizeMode(QQuickView::SizeRootObjectToView);
>         _socialWindow->setMinimumWidth(640);
>         _socialWindow->setMinimumHeight(300);
>     }
>
>     _socialWindow->engine()->clearComponentCache();
>     _socialWindow->setSource(QUrl(source)); // source is a patch to QML file
>
> then I post to twitter and then I destroy window:
>
> if(_socialWindow != NULL)
>     {
>         _socialWindow->deleteLater();
>         _socialWindow = NULL;
>     }
>
> First time all is OK: I authorize and share. But second time browser opens
> with logged user. How to clear window? Why did it not reset after delete
> and create new?
>

Hi Николай,

I think what you’re seeing is the session cookie for whatever social
service you’re logging into being persisted to disk, so the second time you
instantiate the WebView the cookie is being picked up and the user is
automatically logged in.

I assume you’re using QtWebKit’s WebView. If so, you might want to try
setting experimental.preferences.privateBrowsingEnabled to true on your
WebView instance.

I hope this helps.

 Olivier

Follow ups

References