Thanks for the tip.  I tried it right away, but it didn't work (do I
have to implement onTimeout callback to decrement
Ajax.activeRequestCount?)

I did the following and it seems working fine.

...
...
...
this._request.transport.abort();

// for Opera and Safari
if(Prototype.Browser.Opera || Prototype.Browser.WebKit)
{
        Ajax.activeRequestCount--;
}

On Jun 19, 6:43 pm, "Irfan, Ghouseuddin Syed" <[EMAIL PROTECTED]>
wrote:
> This happens because onTimeout never fires on Safari which updates the
> activeRequestCount.
>
> Instead of invoking abort on transport directly you can extend the
> Ajax.Request class with the following method. It takes care of calling
> onTimeout for Safari thus updating the activeRequestCount.
>
> Ajax.Request.prototype.abortRequest = function() {
>   this.aborted = true;
>   this.transport.abort();
>   if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){
>     (this.options['onTimeout'] || Prototype.emptyFunction)();
>   }
>
> }
>
> Just paste the code anywhere after your prototype.js include.
>
> Usage:
>
> var myReq = new Ajax.Request(blah..blah..);
> myReq.abortRequest();
>
> -----Original Message-----
> From: rubyonrails-spinoffs@googlegroups.com
>
> [mailto:[EMAIL PROTECTED] On Behalf Of Satoru
> Moriwaki
> Sent: Thursday, June 19, 2008 2:18 PM
> To: Ruby on Rails: Spinoffs
> Subject: [Rails-spinoffs] Aborting Ajax request
>
> Hi,
>
> Does anyone know why Prototype invokes the Ajax.Responders onComplete
> method on IE and FireFox but not on Safari when Ajax.Request is
> aborted by invoking the transport.abort() method? (Is it a bug for
> Safari not implementing the XMLHttpRequest object correctly?)
>
> If I invoke the transport.abort(), it screws up the
> Ajax.activeRequestCount on Safari since Ajax.Responders onComplete is
> not invoked.
>
> Please let me know if there is a work around for this or if there is a
> better way of aborting Ajax request.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to