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

--[ UxBoD ]-- uxbod at splatnix.net
Thu Sep 22 08:58:32 BST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20110922/3b6fbbca/attachment.html 


More information about the ZendTo mailing list