This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Is there a way to clear the Active Logins in Firefox Programmatically (say Java)

more options

I need to clear active login cache stored by the browser during login in order to avoid automatic login of user if the user clicks back button after logout or access the same link in new tab before closing the browser. I am able to manually clear and it works as expected. But I need to do it programmatically and couldn't find any feasible solution.

I need to clear active login cache stored by the browser during login in order to avoid automatic login of user if the user clicks back button after logout or access the same link in new tab before closing the browser. I am able to manually clear and it works as expected. But I need to do it programmatically and couldn't find any feasible solution.

All Replies (13)

more options

Type about:preferences#privacy<enter> in the address bar. The button next to History, select Use Custom Settings.

At the bottom of the page, turn on Clear History When Firefox Closes. At the far right, press the Settings button. Turn on Cache, Form And Search History, and whatever else you want.

more options

I have already made these changes and it works as expected after browser close. But that is not what I need, I wanted to clear the active login and destroy the session history once I click logout in a programmatic way Or disable the active login from storing.

more options

Private Browsing - Use Firefox without saving history

Firefox Private Browsing is great for viewing websites without saving things like cookies, temp files, and a history of the pages you visit.

more options

Yeah that might help but I do not want to use private browsing. I just wanna know is there any programmatic way to clear active logins in firefox.

more options

Sofeiya said

I have already made these changes and it works as expected after browser close. But that is not what I need, I wanted to clear the active login and destroy the session history once I click logout in a programmatic way Or disable the active login from storing.

If you've made the changes to delete history when you close firefox, right by that you should be able to click on "clear history" where you choose what to clear when firefox closes and at the bottom it will say "clear now". If you don't have cookies chosen, active logins will not close.

evie127 moo ko soppali ci

more options

I do not want to close the browser after logging out as I would be working in another tab and so I would need a solution where it can be cleared without closing the browser.

more options

Sofeiya said

I do not want to close the browser after logging out as I would be working in another tab and so I would need a solution where it can be cleared without closing the browser.

What your asking for is the impossible to do. If it could be done someone on the internet would've made a posting of it already. Anything on a Active browser will stay active until you close it.

WestEnd moo ko soppali ci

more options

WestEnd said

Sofeiya said
I do not want to close the browser after logging out as I would be working in another tab and so I would need a solution where it can be cleared without closing the browser.

What your asking for is the impossible to do. If it could be done someone on the internet would've made a posting of it already. Anything on a Active browser will stay active until you close it.

Did you see the picture I posted? I do it all the time without closing the browser. You can click on the "clear now" and it will clear all the stuff you toggled without closing the browser. Try it. I've done other things that people have told me was impossible before.

more options

evie127 said

WestEnd said
Sofeiya said
I do not want to close the browser after logging out as I would be working in another tab and so I would need a solution where it can be cleared without closing the browser.

What your asking for is the impossible to do. If it could be done someone on the internet would've made a posting of it already. Anything on a Active browser will stay active until you close it.

Did you see the picture I posted? I do it all the time without closing the browser. You can click on the "clear now" and it will clear all the stuff you toggled without closing the browser. Try it. I've done other things that people have told me was impossible before.

Or click the library button and then clear all history like in this picture, you don't have to close the browser in that case either.

more options

In most cases the login state is stored in cookies, so clearing specific cokies should be sufficient. Active Logins is about using Basic Authentication as is used for instance for FTP sites (you get a special pop-up to provide a username and password).

more options

Sofeiya said

I need to clear active login cache stored by the browser during login in order to avoid automatic login of user if the user clicks back button after logout or access the same link in new tab before closing the browser. I am able to manually clear and it works as expected. But I need to do it programmatically and couldn't find any feasible solution.

Is it your site?

Your logout code should:

(A) invalidate/terminate/expire the user's session in your app, and

(B) (optionally) overwrite the cookie for the session.

New Tab Scenario: The user should be redirected to your login page. As long as you invalidated the session, the old cookie is useless to the user and can't log them back in.

Back Button Scenario: To avoid the user seeing expired page content, you can:

(A) send Cache-Control: no-store to Firefox with sensitive pages to prevent caching, and/or

(B) force Firefox to run a function to check logged-in status by hooking the pageshow event (see https://developer.mozilla.org/docs/We.../pageshow)

See also: https://developer.mozilla.org/Firefox/Releases/1.5/Using_Firefox_1.5_caching

more options

WestEnd and evie127 :

Manually clearing the Active logins and cache works fine for me. But all I want is how to do it programmatically.

jscher2000 :

Thank you for your suggestions. I have tried all these but it didn't work out for me.

more options

Hi Sofeiya, please try: Where to go for developer support.