8299 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 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

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

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

8299 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 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
  • 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?

8299 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 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
  • 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 :)

8299 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 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
  • 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

8299 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 Moderator says
You’re right, doesn’t work in opera :(

does it work in Safari for you?

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by