File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Firefox window open on unload

 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I like to open a new window, when the user closed the current window.

I tried with the below code it's working in IE, But it's not working in firefox. Please assist


Reason: Am trying to open a new window. Just to say that the users session is logged out.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ugh. Don't.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not possible in firefox ?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know, and I don't care: if I close a window of a website, why on earth would I want it to open *another* one? Bad user experience.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually am tracking user session's in a table. If suppose the user closed the window without logging out. How to track that.. Please assist me.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The session will time out; use a session listener.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are rite !!.. My session timeout is more say for example 10 mins, But if the user closed the window and again if the user is logging the system wont allow.

Since I have table called userslist and I will insert 1 row at the time of logging and delete that while logging out or while session time out.

Could you please give me some suggestion.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you care if the same user logged in again?
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just want to track the in time and out time of all users. Thats why I am inserting 1 record while logging in. He the user closed the window. I can't track the out time. Also until the session expired the user can't re-login I mean the system won't allow. we designed like that.

I need a suggestion to trigger a event at the time of user closing the window. so that I will update the out time..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Meet Gaurav wrote: the system won't allow. we designed like that.

You designed poorly.

I need a suggestion to trigger a event at the time of user closing the window. so that I will update the out time..

As has been pointed out in these forums time and time again, you can;t reliably do this. You'll just need to rely upon the session timeout like the rest of the world.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Meet Gaurav wrote: the system won't allow. we designed like that.

You designed poorly.

I agree: what's the reason for not allowing this? It seems pretty arbitrary, and potentially *very* annoying.

Trivial example: I work ten minutes from my apartment. I log in to your app. Without logging out, I go to work. I try to log in, and I can't. Arbitrary and capricious. If I can provide you my credentials, it shouldn't matter.

You could just set the session timeout to something very short, but that can be a little irritating too. Are you working on a website that has massive security restrictions?
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the site is designed more for security.. Is there any other option ?

My requirement is to log in time and out time of every users. If the users close the window ? How do I record out time ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Meet Gaurav wrote:Yes, the site is designed more for security

Does your design really enhance security? Really?

My requirement is to log in time and out time of every users. If the users close the window ? How do I record out time ?

As you cannot detect when a browser window is closed, you'll have to rely upon the session timeout like everyone else. This has been a recording.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Thanks for the reply..

If suppose my session time out is 1 Hr. Even if the user closed the window after 5 mins and again logged in after 10 mins,.. This shows some bad data in the DB rite.. I mean 1 sessions at the same time.

Please help. My application is designed in struts
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Meet Gaurav wrote:Please help.

What do you want help with? How many times must it be repeated that you cannot reliably detect when a browser window closes? Pleading for something that can't be done won't make it any more possible.

A better idea might be to re-evaluate your design and requirements.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Meet Gaurav wrote:If suppose my session time out is 1 Hr.

Why would you have a session timeout of 1 hour if your site is supposed to be secure?! That makes no sense.

Are you writing bank software? Government? Military? If not, what kind of information are you trying to protect?

If you cannot trust the users to be responsible and log out, you're pretty much doomed: what if the browser crashes? Or someone trips over the cord on my machine? Let alone that there's no great way to tell if the user closes the browser.

(You could use Ajax, but that would continuously refresh the session, which may or may not be what you want.)

I still believe your initial requirements have lead you down a road that dead-ends.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic