Tobie Langel wrote:
>> So Tobie, how would you use the file protocol for an ajax request?
>>     
> It's mainly a backwards compatibility issue (plus it can be useful for
> testing purposes).
>   
After some testing, I am seeing how using "onNetworkError" is not 
helpful since some network errors (such as dropping vpn connection) 
produce exceptions anyway.  It makes more sense if all network errors 
trigger the "onException" callback.

As far as local file support: Tobie, would the folllowing "isLocalUrl" 
test be sufficient to test if the file protocol is used?  I'm not real 
familiar with file protocol behavior, especially across OSs and Browsers.

I'm just thinking it would be best to submit a patch that addresses both 
issues since you mention that requesting local files looks like a 
network error due to transport.status = 0.

- Ken Snyder



Ajax.Request = Class.create(Ajax.Base, {
  ...
  request: function(url) {
    this.url = url;

    // we have a local request if:
    //   the url begins with "file" OR
    //   the window url begins with "file" and the url does not contain 
"://"
    this.isLocalUrl = (this.url.indexOf('file') === 0 || (
      window.location.href.indexOf('file') === 0 && 
this.url.indexOf('://') == -1
    ));

    this.method = this.options.method;
    ...
  }
});

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to