[Interest] [Ubuntu-phone] How to reset QML WebView?

Olivier Tilloy olivier.tilloy at canonical.com
Mon Jun 2 23:24:00 CEST 2014


On Mon, Jun 2, 2014 at 7:59 PM, Николай Шатохин <n.shatokhin at gmail.com>
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140602/f43cfcd3/attachment.html>


More information about the Interest mailing list