I ran into a problem in the ionic iOS application where my site does not save cookies and clear the cache and clear the session cache does not work. I am using the Cordova Inappbrowser plugin.
It works great on Android.
var ref = window.open(url, '_blank','location=no,toolbar=yes,clearcache=no,clearsessioncache=no');
But on iOS, it does not work. When I first provide my credentials and go to the application, and then I exit the application and open it again, it again asks for my credentials (which works great in ANDROID)
After further digging, I found that the cookie that should have been saved is marked as isSessionOnly = true and expires = null .
This way I see a cookie inside the session, but clears when the application is closed
I found my result by writing the following code in the CDVinAppbrowser.m class:
- (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options { NSHTTPCookie *cookie; NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage]; for (cookie in [cookieJar cookies]) { NSLog(@"%@", cookie); }
So how to save cookies or make inappbrowser with options working with clearcache = no and clearsessioncache = no in iOS.
Note. I am completely new to iOS / Swift. So, I need to know where to place the code in fast classes.
Edit for Bounty (AndroidMechanic)
I have the same problem when it works fine for android, but on iOS it asks for credentials every time the application restarts. I suggest generosity for a solution where you can avoid using your own code.