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

RE: [ydn-javascript] detect if JS engine supports AJAX

Expand Messages
  • dan.doyle@cexp.com
    It looks like I can check and see if the object returned is null or undefined. Does that sound right? Dan ________________________________ From:
    Message 1 of 5 , Mar 1 11:31 AM
    • 0 Attachment

      It looks like I can check and see if the object returned is null or undefined. Does that sound right?

       

      Dan

       


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

       

      On 3/1/07, dan.doyle@cexp. com <dan.doyle@cexp. com> 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;
      }
      },

      --
      Matt Warden
      Cleveland , OH , USA
      http://mattwarden. com

      This email proudly and graciously contributes to entropy.

    • 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 2 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 3 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.