Loading ...
Sorry, an error occurred while loading the content.

Re: detect if JS engine supports AJAX

Expand Messages
  • tssha
    ... user s system as Yahoo! uses it? I need this in order to support browsers that do not support AJAX, but still have javascript available. ... http. ...
    Message 1 of 5 , Mar 1 12:10 PM
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "Matt Warden" <mwarden@...> wrote:
      >
      > On 3/1/07, dan.doyle@... <dan.doyle@...> wrote:
      > >
      > > Is there a utility in YAHOO!UI to detect if AJAX is available on a
      user's system as Yahoo! uses it? I need this in order to support
      browsers that do not support AJAX, but still have javascript available.
      > >
      >
      > Surprisingly, there does not seem to be any way to tell if
      instantiation fails:
      >
      > createXhrObject:function(transactionId)
      > {
      > var obj,http;
      > try
      > {
      > // Instantiates XMLHttpRequest in non-IE browsers and assigns to
      http.
      > http = new XMLHttpRequest();
      > // Object literal with http and tId properties
      > obj = { conn:http, tId:transactionId };
      > YAHOO.log('XHR object created for transaction ' + transactionId,
      > 'info', 'Connection');
      > }
      > catch(e)
      > {
      > for(var i=0; i<this._msxml_progid.length; ++i){
      > try
      > {
      > // Instantiates XMLHttpRequest for IE and assign to http.
      > http = new ActiveXObject(this._msxml_progid[i]);
      > // Object literal with conn and tId properties
      > obj = { conn:http, tId:transactionId };
      > YAHOO.log('ActiveX XHR object created for transaction ' +
      > transactionId, 'info', 'Connection');
      > break;
      > }
      > catch(e){}
      > }
      > }
      > finally
      > {
      > return obj;
      > }
      > },
      >

      YAHOO.util.Connect.asyncRequest() returns null if instantiation fails.

      /* debug version */
      var o = this.getConnectionObject();
      if(!o){
      YAHOO.log('Unable to create connection object.', 'error','Connection');
      return null;
      }

      Regards,
      Thomas
    • dan.doyle@cexp.com
      Thanks for the help. ________________________________ From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of tssha Sent:
      Message 2 of 5 , Mar 1 2:04 PM
      • 0 Attachment

        Thanks for the help.

         


        From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of tssha
        Sent: Thursday, March 01, 2007 1:11 PM
        To: ydn-javascript@yahoogroups.com
        Subject: [ydn-javascript] Re: detect if JS engine supports AJAX

         

        --- In ydn-javascript@ yahoogroups. com, "Matt Warden" <mwarden@... > wrote:

        >
        > On 3/1/07, dan.doyle@.. . <dan.doyle@. ..> wrote:
        > >
        > > Is there a utility in YAHOO!UI to detect if
        w:st="on">AJAX is available on a
        user's system as Yahoo! uses it? I need this in order to support
        browsers that do not support AJAX , but still have javascript available.
        > >
        >
        > Surprisingly, there does not seem to be any way to tell if
        instantiation fails:
        >
        > createXhrObject: function( transactionId)
        > {
        > var obj,http;
        > try
        > {
        > // Instantiates XMLHttpRequest in non-IE browsers and assigns to
        http.
        > http = new XMLHttpRequest( );
        > // Object literal with http and tId properties
        > obj = { conn:http, tId:transactionId };
        > YAHOO.log('XHR object created for transaction ' + transactionId,
        > 'info', 'Connection' );
        > }
        > catch(e)
        > {
        > for(var i=0; i<this._msxml_ progid.length; ++i){
        > try
        > {
        > // Instantiates XMLHttpRequest for IE and assign to http.
        > http = new ActiveXObject( this._msxml_ progid[i] );
        > // Object literal with conn and tId properties
        > obj = { conn:http, tId:transactionId };
        > YAHOO.log('ActiveX XHR object created for transaction ' +
        > transactionId, 'info', 'Connection' );
        > break;
        > }
        > catch(e){}
        > }
        > }
        > finally
        > {
        > return obj;
        > }
        > },
        >

        YAHOO.util.Connect. asyncRequest( ) returns null if instantiation fails.

        /* debug version */
        var o = this.getConnectionO bject();
        if(!o){
        YAHOO.log('Unable to create connection object.', 'error','Connection ');
        return null;
        }

        Regards,
        Thomas

      Your message has been successfully submitted and would be delivered to recipients shortly.