[ZendTo] Re: RFE: Detect navigating away from page

--[ UxBoD ]-- uxbod at splatnix.net
Thu Sep 22 13:19:38 BST 2011


Darn :( FF, IE and Chrome all handle it fine. I believe it has been submitted to W3 as a standard but perhaps not all browsers honour it yet. 
-- 
Thanks, Phil 

----- Original Message -----

> I just tried it in Safari and it had no effect. :(

> On 22/09/2011 08:58, --[ UxBoD ]-- wrote:
> > Jules, I have this working by adding into the top of
> > new_dropoff.tpl:
> 

> > var unload_msg = "You will cancel your upload!";
> 
> > var ignore_unload = true;
> 

> > $(document).ready(function(){
> 

> > function doBeforeUnload() {
> 
> > if(ignore_unload) return; // Let the page unload
> 

> > if(window.event)
> 
> > window.event.returnValue = unload_msg; // IE
> 
> > else
> 
> > return unload_msg; // FF
> 
> > }
> 

> > if(window.body)
> 
> > window.body.onbeforeunload = doBeforeUnload; // IE
> 
> > else
> 
> > window.onbeforeunload = doBeforeUnload; // FF
> 

> > and then in the submitform() function, around line 330, the
> > following
> > code:
> 

> > document.dropoff.submit();
> 
> > ignore_unload = false;
> 

> > Now once a user clicks Dropoff Files and they attempt to navigate
> > away a popup will ask them if they are sure.
> 
> > --
> 
> > Thanks, Phil
> 

> > ----- Original Message -----
> 

> > > Hi Jules, A test user informed us that if you are performing a
> > > dropoff and navigate away from the page the upload is cancelled.
> > > Would it be feasible to add some JS code for using
> > > onbeforeunload()
> > > to warn the user ?
> > 
> 
> > > --
> > 
> 
> > > Thanks, Phil
> > 
> 

> > > _______________________________________________
> > 
> 
> > > ZendTo mailing list
> > 
> 
> > > ZendTo at zend.to
> > 
> 
> > > http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto
> > 
> 
> > _______________________________________________
> 
> > ZendTo mailing list ZendTo at zend.to
> > http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto
> 
> Jules

> --
> Julian Field MEng CITP CEng www.Zend.To Follow me at
> twitter.com/JulesFM
> PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654

> 'It's okay to live without all the answers' - Charlie Eppes, 2011
> 'All programs have a desire to be useful' - Tron, 1982
> 'That is the land of lost content,
> I see it shining plain,
> The happy highways where I went,
> And cannot come again.' - A.E. Houseman
> _______________________________________________
> ZendTo mailing list
> ZendTo at zend.to
> http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20110922/6cd86c53/attachment.html 


More information about the ZendTo mailing list