Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear Phonegap's InAppBrowser Cache Programmatically

I am using Oauth 2.0 for Google authorization into a hybrid app. I am using PhoneGap's InAppBrowser API and it works perfectly; however, I want to be able to clear the cache of the InAppBrowser after someone clicks the local logout button. I have tried adding "clearcache=yes" and "clearsessioncache=yes", but they do not seem to do anything. Without clearing the cache when someone tries to log back in it validates the token with the previously signed in account. The only way I can sign out is to keep trying to login until I get the Google permissions screen and can manually logout. Is there a way I can delete everything associated to the InAppBrowser programmatically?

Thanks

like image 319
benjipelletier Avatar asked Dec 03 '14 02:12

benjipelletier


1 Answers

As said: clearcache or clearsessioncache is only for Android. read this API Doc

In case of Android so before re-opening:

window.open("domain.com", "_blank", "location=no,clearsessioncache=yes"); 

For iOS: check this out.

Alternatives:

  1. Clear the session cookie via javascript directly or indirectly (check this - JQuery Cookie clearing )
  2. Phonegap/Cordova plugin that allows you to clear cookies of the webview...see this
like image 166
AAhad Avatar answered Oct 05 '22 22:10

AAhad