X
Tap here to go to the mobile version of the site.

Support Forum

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

Posted

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.

Additional System Details

Application

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36

More Information

FredMcD
  • Top 10 Contributor
4306 solutions 60455 answers

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.

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.

Question owner

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.

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.
FredMcD
  • Top 10 Contributor
4306 solutions 60455 answers

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.

[https://support.mozilla.org/en-US/kb/private-browsing-use-firefox-without-history 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.

Question owner

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.

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.
evie127 1 solutions 20 answers

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.

''Sofeiya [[#answer-1119709|said]]'' <blockquote> 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. </blockquote> 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.

Modified by evie127

Question owner

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.

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.
WestEnd 60 solutions 5387 answers

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.

''Sofeiya [[#answer-1120051|said]]'' <blockquote> 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. </blockquote> 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.

Modified by WestEnd

evie127 1 solutions 20 answers

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.

''WestEnd [[#answer-1120095|said]]'' <blockquote> ''Sofeiya [[#answer-1120051|said]]'' <blockquote> 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. </blockquote> 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. </blockquote> 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.
evie127 1 solutions 20 answers

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.

''evie127 [[#answer-1120101|said]]'' <blockquote> ''WestEnd [[#answer-1120095|said]]'' <blockquote> ''Sofeiya [[#answer-1120051|said]]'' <blockquote> 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. </blockquote> 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. </blockquote> 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. </blockquote> 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.
cor-el
  • Top 10 Contributor
  • Moderator
17679 solutions 159906 answers

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).

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). * https://en.wikipedia.org/wiki/Basic_access_authentication
jscher2000
  • Top 10 Contributor
8837 solutions 72222 answers

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

''Sofeiya [[#question-1220727|said]]'' <blockquote> 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. </blockquote> 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 <code>Cache-Control: no-store</code> 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/Web/Events/pageshow]) See also: https://developer.mozilla.org/Firefox/Releases/1.5/Using_Firefox_1.5_caching

Question owner

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.

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.
jscher2000
  • Top 10 Contributor
8837 solutions 72222 answers

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

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