[ZendTo] Re: "Leave This Page" warning when dropping off a file
Everton Bruno Bernardi
ebbernardi at gmail.com
Wed Nov 26 13:29:09 GMT 2014
It worked for me too.
Thank you so much.
On Tue, Nov 25, 2014 at 9:22 PM, Andrew Martin <amartin at xes-inc.com> wrote:
> ----- Original Message -----
> > From: "Gray D. McCord" <gdm at sangabriel.com>
> > To: "ZendTo Users" <zendto at zend.to>
> > Sent: Tuesday, November 25, 2014 4:40:55 PM
> > Subject: [ZendTo] Re: "Leave This Page" warning when dropping off a file
> >
> > I ran into this quite a while back. I have two possible things you can
> try.
> > Both involve edits to the new_dropoff.tpl file:
> > SOLUTION 1:
> > First, my solution, which works for me is to edit the submitform()
> script in
> > the new_dropoff.tpl file by setting "ignore_upload = true;” in the submit
> > form script and my problem went away. Now, my Zendto is highly customized
> > with a JS file uploader and php5.5, so this may not work for you. Also be
> > sure to make sure it doesn ’ t break something on other browsers.
> > < script type= "text/javascript" >
> > function submitform () {
> > if ( validateForm ()) {
> > document . fileupload . submit ();
> > ignore_unload = true ; //TODO: Changed to true to get rid of Chrome
> error.
> > Need to figure out why the error occurs.
> > }
> > }
> > </ script >
> >
> >
> > SOLUTION 2, from Jules, who is the Zendto owner and actually knows what
> he’s
> > doing:
> >
> >
> > From: Jules [ mailto:Jules at Zend.To ]
> > Sent: 02 January 2014 11:15
> > To: John Webber (NBI)
> > Cc: ZendTo Users
> > Subject: Re: FW: Issue with Chrome browser - "Leave this Page"
> >
> >
> >
> >
> > I've got a quick fix for this. Unfortunately it means you can navigate
> away
> > from (and hence abort) a running upload, but it stops the Chrome
> warning, so
> > is better than nothing.
> >
> > You want to edit /opt/zendto/templates/new_dropoff.tpl file:
> >
> > Find the start of the "submitform" function, and add the last line of
> this
> > little code snippet:
> >
> > <script type="text/javascript">
> > function submitform() {
> > if (validateForm()) {
> > window.onbeforeunload=function(){}
> >
> > Jules.
> > ————————————————————————
> > Good Luck!
> > Gray McCord
> > Adapt, Mutate, Migrate, or Die
> > -C. Darwin
> >
> Gray,
>
> Thanks for the help. It looks like both of these solutions achieve the
> same effect.
> The first solution makes the doBeforeUnload function return immediately
> (rather
> than doing anything):
> function doBeforeUnload() {
> if(ignore_unload) return; // Let the page unload
>
> if(window.event)
> window.event.returnValue = unload_msg; // IE
> else
> return unload_msg; // FF
> }
>
> This function is set as the target for onbeforeunload just below where it
> is defined:
> if(window.body)
> window.body.onbeforeunload = doBeforeUnload; // IE
> else
> window.onbeforeunload = doBeforeUnload; // FF
>
>
> The solution that Jules posted changes the function that is called for
> onbeforeunload
> to be an empty function, rather than doBeforeUnload:
> <script type="text/javascript">
> function submitform() {
> if (validateForm()) {
> window.onbeforeunload=function(){}
>
> Again thanks for the help!
>
> Andrew
>
> _______________________________________________
> ZendTo mailing list
> ZendTo at zend.to
> http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto
>
--
*Everton Bruno Bernardi <http://google.com/+EvertonBrunoBernardi>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20141126/4ff44711/attachment.html
More information about the ZendTo
mailing list