Maninder, Singh a écrit :
> How about -
>
> detectAJAX = function() {
> try { xmlhttpcheck = new ActiveXObject("Msxml2.XMLHTTP"); }
> catch (e) { try { xmlhttpcheck = new
> ActiveXObject("Microsoft.XMLHTTP"); }
> catch (e) { try { xmlhttpcheck = new XMLHttpRequest(); }
> catch (e) { xmlhttpcheck = false; }}}
> if (!xmlhttpcheck) {
> return false;
> }
> else {
> return true;
> }
> };
Is this intended as a joke, Mandy :-)?
First: the final 6 lines should read "return xmlhttpcheck;" for the sake
of conciseness w/o loss of readability.
Second, this duplicates the code from Ajax.getTransport(). I mean,
scary duplicates, because it doesn't even use Try.These. Of course,
maybe you're going for no-Prototype-dependency, but isn't this a
Prototype/s.a.u. list?
Therefore, the previous solution: !!Ajax.getTransport(), is way better,
wouldn't you say?
Best,
--
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---
[Rails-spinoffs] Re: Detecting AJAX Support
Christophe Porteneuve aka TDD Thu, 14 Sep 2006 04:18:50 -0700
- [Rails-spinoffs] Re: Detecting AJAX Support Maninder, Singh
- [Rails-spinoffs] Re: Detecting AJAX Sup... Christophe Porteneuve aka TDD
- [Rails-spinoffs] Re: Detecting AJAX... Maninder, Singh
