8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says

Sorry this is in all marketplaces but theres no “corner” for developers to discuss things :(

So, this is targeted at AD / CC and TF users…

I’ve made an online application in Flash where users can login, perform tasks etc etc… the backend is all ZendAMF (php)...

There is a logout button but should they not click it and just go and close the window whats the quickest most guaranteed method for logging them out?

I could use ExternalInterface within Flash which allows Flash and JS comms (tested in all browsers) and listen for the window.onunload event and then call the flash to invoke ZendAMF to log them out but is there a quicker way, this seems a little long winded…

Also window.onunload doesn’t appear to be thrown in safari / opera on W7 ?? :( (it works within FF 3 .6, IE8 and Chrome)

Anyone got any ideas / tuts / files that could handle this functionality or an alternative approach?

Cheers

Matt / MSFX

1829 posts Time is what you desire most, but waste carelessly.
  • Author Level 9
  • Elite Author
  • Exclusive Author
  • Trendsetter
+9 more
Firsh
says

maybe session timeout? or I’m completely wrong about what’s going on..

8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says
maybe session timeout? or I’m completely wrong about what’s going on..

isn’t that client side though? when they close the browser the session ends?

I basically need to server to detect that the user has left without logging out…

815 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 1
  • Freebie
+3 more
rvision_
says

you can try with jQuery, it probably works with all browsers:

$(window).unload( function () { alert(“Bye now!”); } );

but this way you should call flash from javascript, not other way around (I don’t know about ExternalInterface details, but I’m sure it can be worked out)

4140 posts
  • 7 Years of Membership
  • Affiliate Level 1
  • Author Level 4
  • Brazil
+5 more
tsafi
says

The code that i gave you didn’t work for you?

8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says
The code that i gave you didn’t work for you?

that was for popups… and for several browsers no it wouldn’t work :(

you can try with jQuery, it probably works with all browsers:

jQuery is javascript, if regular javascript doesn’t catch it how would jQuery?

815 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 1
  • Freebie
+3 more
rvision_
says
The code that i gave you didn’t work for you?

that was for popups… and for several browsers no it wouldn’t work :(

you can try with jQuery, it probably works with all browsers:
jQuery is javascript, if regular javascript doesn’t catch it how would jQuery?

Because javascript has browser-specific events/quirks/etc. and jquery knows about them :)

8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says
Because javascript has browser-specific events/quirks/etc. and jquery knows about them :)

unfortunately not :(

Still works in FF, IE8 and Chrome… no luck in Opera or Safari :x :(
(oddly this was also the case with popups)

http://msfx.co.uk/temp/jquery/
(closing the page should give an alert)

Any other ideas?

815 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 1
  • Freebie
+3 more
rvision_
says

You’re right, doesn’t work in opera :(

Events The unload event is not fired. It’s a limitation of Opera, you can report it here. The example below doesn’t work.

$(document).ready( function() { $(window).unload(function(){ alert(“ok”) }) } )

http://docs.jquery.com/Known_Issues

8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says
You’re right, doesn’t work in opera :(

does it work in Safari for you?

by
by
by
by
by
by