Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 38
Registered: ‎06-07-2010
My Device: BlackBerry Bold 9790
My Carrier: none
Accepted Solution

Clear BrowserField cookies

I've been looking for a way to clear the BrowserField cookies for quite a while now but haven't found a solution yet.

 

In my application, I need to clear the BrowserField's cookies at specific points of the application flow. Is there already a way to clear those cookies?

Contributor
Posts: 38
Registered: ‎06-07-2010
My Device: BlackBerry Bold 9790
My Carrier: none

Re: Clear BrowserField cookies

Doesn't anyone know how the clear the stored information of a BrowserField?

 

I tried using the BrowserField's method refresh() in fetch() for certain request (e.g. logout request). The strange behaviour was that it seemed to only work if the subsequent call to requestContent() was successful.

 

// bf is my BrowserField member
// myLogoutUrl is a String containing the unique first part of my logout URL
protected void fetch() {
  // clear the login cookie on logout
  if (url.startsWith(myLogoutUrl)) {
    bf.refresh();
  }
  bf.requestContent(url);
}

 

Developer
Posts: 207
Registered: ‎09-10-2010
My Device: Not Specified

Re: Clear BrowserField cookies

Have u looked at BrowserFieldCookieManager? Not sure if that can solve ur problem. Probably use setCookies() method to clear cookie as browser make any request.

Contributor
Posts: 38
Registered: ‎06-07-2010
My Device: BlackBerry Bold 9790
My Carrier: none

Re: Clear BrowserField cookies

I have already had a look at BrowserFieldCookieManager but using setCookie() didn't make a difference. Today, I found out, that the problem seems to be not within the app (the call to refresh() turned out to really clear the BrowserField), but secret cookies are stored by the server my requests are sent to.

 

Anyway, thanks for your help indusBULL!

New Contributor
Posts: 4
Registered: ‎07-06-2011
My Device: BB Torch
My Carrier: At&t

Re: Clear BrowserField cookies

im facing similar issue ...can you pls explaing how you solved this problem...it will be of great help.

Contributor
Posts: 38
Registered: ‎06-07-2010
My Device: BlackBerry Bold 9790
My Carrier: none

Re: Clear BrowserField cookies

hi nrpathak,

 

there was no real solution for me since the problem was that secret cookies that caused it were stored on a server. on the device, the refresh() method worked best to clear information stored by BrowserField ...