Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

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.

所有回覆 (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 於 修改

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 於 修改

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.