8238 posts Community Moderator
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Attended one of our Meetups around the world
+9 more
MSFX Volunteer 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

1706 posts Time is what you desire most, but waste carelessly.
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Sells items exclusively on Envato Market
+6 more
Firsh says

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

8238 posts Community Moderator
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Attended one of our Meetups around the world
+9 more
MSFX Volunteer 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…

814 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Contributed a free file of the month
+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
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Located in Brazil
+3 more
tsafi says

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

8238 posts Community Moderator
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Attended one of our Meetups around the world
+9 more
MSFX Volunteer 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?

814 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Contributed a free file of the month
+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 :)

8238 posts Community Moderator
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Attended one of our Meetups around the world
+9 more
MSFX Volunteer 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?

814 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Contributed a free file of the month
+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

8238 posts Community Moderator
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Attended one of our Meetups around the world
+9 more
MSFX Volunteer moderator says
You’re right, doesn’t work in opera :(

does it work in Safari for you?

by
by
by
by
by
by