Question

I'm developing application in Qt 4.8.1. I trying to develope a simple web browser. I want to create function logout on site.

As I understand the required information is stored in cookies. In webView->page()->networkAccessManager()->cookieJar() I have not found clearing cookies. May be the session must be closed. Isn't? Help me to create the logout function.

Was it helpful?

Solution

Maybe try delete the webpage object of the webview and instantiate a newPage object. and then webView->setPage(newPage);

OTHER TIPS

You will need to simulate a logout using Javascript evaluation on the webPage->page()->mainFrame() object. For example, you could make a function like this to log out:

void Program::logout()
{
    webView->page()->mainFrame->evaluateJavaScript("websiteLogoutJavaScript();");
}

Of course, change the JS in the evaluate call to match the logout process. This method will depend on how to physically logout of the website. If it's a button, you could invoke a click event on the button. If it's a hyperlink that goes to a logout page, you could just navigate to the logout page. These are just some suggestions, but you will need to change the state of the DOM using JavaScript.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top