bentpieceoflight-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-22 14:36 UTC
Prototype.Browser.IE6 & IE7
I find the Prototype.Browser methods so useful that I made two more that others might find helpful: Prototype.Browser.IE6 = Prototype.Browser.IE <http://prototype.browser.ie/>&& parseInt( navigator.userAgent.substring (navigator.userAgent.indexOf("MSIE")+5))==6; Prototype.Browser.IE7 = Prototype.Browser.IE <http://prototype.browser.ie/>&& !Prototype.Browser.IE6; -- -=jack[turner-fBgUz5AM8P2sTnJN9+BGXg@public.gmane.org & thoughtbucket.tumblr.com] --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
> <http://prototype.browser.ie/>Google group''s (or other) engine apply "smart" regexp ;-) Actually, bentpieceoflight-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org writed: Prototype.Browser.IE6=Prototype.Browser.IE && parseInt(navigator.userAgent.substring (navigator.userAgent.indexOf("MSIE")+5))==6; Prototype.Browser.IE7=Prototype.Browser.IE && !Prototype.Browser.IE6;> I find the Prototype.Browser methods so useful that I made two more that > others might find helpful:Why only IE. We can assign Browser.Version, for example. Alsa we can assign OS (Win, Mac, etc). Possible, it will be better to define Prototype.Environment and use tag-like approach: Prototype.Environment = ["Win", ["IE", "7.0"]] or Prototype.Environment = ["Win", ["Opera", "9"]]. But I don''t think that prototypejs really need it. May be I''m wrong. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 23, 12:36 am, bentpieceofli...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I find the Prototype.Browser methods so useful that I made two more that > others might find helpful:Browser detection is a seriously flawed strategy for writing cross- browser scripts, just don''t do it. Use feature detection. -- Rob --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
bentpieceoflight-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-24 01:33 UTC
Re: Prototype.Browser.IE6 & IE7
What about when the feature is implemented, just not correctly? Do you think Prototype.Browser.whatever should be removed from prototype.js? I personally find it quite handy for those situations when nothing else seems to work and deadlines are looming. I (probably like most of the people on this list) hate browser detection. If nothing else it isn''t future proof. And who wants to code web pages for Microsoft products when, after all, we really want to code towards standards so that they can become more accepted and be advanced. But when it comes down to a decision between spending several hours coding something "the right way" and coding something in a few minutes that works for 97+ percent of the web.... I find myself in a grey area where perfect conformance to standards seems unrealistic or at least inefficient. That said, I agree with you Rob. I just don''t think its pragmatic in every single situation. On 6/23/07, RobG <rgqld-AFFH1GffN5hPR4JQBCEnsQ@public.gmane.org> wrote:> > > > > On Jun 23, 12:36 am, bentpieceofli...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > I find the Prototype.Browser methods so useful that I made two more that > > others might find helpful: > > Browser detection is a seriously flawed strategy for writing cross- > browser scripts, just don''t do it. Use feature detection. > > > -- > Rob > > > > >-- -=jack[turner-fBgUz5AM8P2sTnJN9+BGXg@public.gmane.org & thoughtbucket.tumblr.com] --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I believe it was either in the changelog or some file in the Prototype source that discussed the reasoning behind the Prototype.Browser. It''s used solely to reduce code complexity and increase code readaibility inside Prototype for the hacks they have to implement. They do the hacking, so that you don''t have to. Prototype is designed to make the same functions work the same across all supported browsers. Its for this reasoning that Protoype.Browser is basic, nor documented on the API. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
bentpieceoflight-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-24 14:29 UTC
Re: Prototype.Browser.IE6 & IE7
Ah, that explains the lack of documentation and features. And makes perfect sense. Thanks for the info Kroc. I''m really impressed that so many people onlist are successful in completely avoiding browser detection. Even the guys who started this whole Rails things (37 Signals) do it as do the guys who started Scriptaculous (Thomas Fuchs at wollzelle) resort to sniffing in some cases. I guess I ought to up my game, so to speak. -jack --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
There are some very rare cases where browser detection is the only way to deal with particular issues. But prototype is designed so WE (ie, the web developer) don''t have to deal with those rare cases. If you think you have no way of avoiding browser sniffing, check to see if prototype already has a wrapper for what you''re trying to accomplish. -Jerod On 6/24/07, bentpieceoflight-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <bentpieceoflight-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Ah, that explains the lack of documentation and features. And makes > perfect sense. Thanks for the info Kroc. > > I''m really impressed that so many people onlist are successful in > completely avoiding browser detection. Even the guys who started this whole > Rails things (37 Signals) do it as do the guys who started Scriptaculous > (Thomas Fuchs at wollzelle) resort to sniffing in some cases. I guess I > ought to up my game, so to speak. > > > -jack > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
"check to see if prototype already has a wrapper for what you''re trying to accomplish." And of course, if not, consider writing a wrapper and submitting it to Prototype for inclusion. On Jun 24, 4:07 pm, "Jerod Venema" <jven...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> There are some very rare cases where browser detection is the only way to > deal with particular issues. But prototype is designed so WE (ie, the web > developer) don''t have to deal with those rare cases. > > If you think you have no way of avoiding browser sniffing, check to see if > prototype already has a wrapper for what you''re trying to accomplish. > > -Jerod > > On 6/24/07, bentpieceofli...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <bentpieceofli...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Ah, that explains the lack of documentation and features. And makes > > perfect sense. Thanks for the info Kroc. > > > I''m really impressed that so many people onlist are successful in > > completely avoiding browser detection. Even the guys who started this whole > > Rails things (37 Signals) do it as do the guys who started Scriptaculous > > (Thomas Fuchs at wollzelle) resort to sniffing in some cases. I guess I > > ought to up my game, so to speak. > > > -jack--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---