browser sniffing in dwr

View: New views
4 Messages — Rating Filter:   Alert me  

browser sniffing in dwr

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In engine.js we have:
    // In IE XHR is an ActiveX control so you can't augment it like this
    if (!document.all) batch.req.batch = batch;
 
This object sniff will affect Opera, as it defines document.all just like IE, so an alternative sniff may be appropriate. Even better might be to extract this functionality into a separate method _isIE() and maybe considering factoring out other browser sniffs if appropriate? (or maybe all other tests can be done as object sniffs)
 
Browser sniffing can be made arbitrarily complex (look at http://www.quirksmode.org/js/detect.html and http://svn.dojotoolkit.org/dojo/dojo/trunk/_base/_loader/hostenv_browser.js) so I am not sure how much of this we want to do in DWR, but we may have use of some of this knowledge in future util.js.
Opinions?
 
Best regards
Mike

Re: browser sniffing in dwr

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

We could steal some code from Dojo, how much code do you think we would need to add?

Doesn't Opera do silent document.all in the same way that Moz does?

Joe.

On 10/24/07, Mike Wilson <mikewse@...> wrote:
In engine.js we have:
    // In IE XHR is an ActiveX control so you can't augment it like this
    if (!document.all) batch.req.batch = batch;
 
This object sniff will affect Opera, as it defines document.all just like IE, so an alternative sniff may be appropriate. Even better might be to extract this functionality into a separate method _isIE() and maybe considering factoring out other browser sniffs if appropriate? (or maybe all other tests can be done as object sniffs)
 
Browser sniffing can be made arbitrarily complex (look at http://www.quirksmode.org/js/detect.html and http://svn.dojotoolkit.org/dojo/dojo/trunk/_base/_loader/hostenv_browser.js ) so I am not sure how much of this we want to do in DWR, but we may have use of some of this knowledge in future util.js.
Opinions?
 
Best regards
Mike


RE: browser sniffing in dwr

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We could steal some code from Dojo, how much code do you think we would need to add? 
Oh, probably just a handful of lines if we only want to detect IE. BTW: here's MS's own instructions on how to detect it: http://msdn2.microsoft.com/en-us/library/ms537509.aspx
 
Should we settle with an on/off IE detection, or go deeper detecting version and other browsers?
Doesn't Opera do silent document.all in the same way that Moz does? 
No, I just tried this quick test in the address bar:
    javascript: alert( !!document.all )
Mozilla -> false
Opera -> true
 
Best regards
Mike

Re: browser sniffing in dwr

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I think that we should perhaps detect browsers that we support, but not expose the detection to users because then we have a greater requirement for accuracy than "we'll it works for us"

Joe.

On 10/24/07, Mike Wilson <mikewse@...> wrote:
We could steal some code from Dojo, how much code do you think we would need to add? 
Oh, probably just a handful of lines if we only want to detect IE. BTW: here's MS's own instructions on how to detect it: http://msdn2.microsoft.com/en-us/library/ms537509.aspx
 
Should we settle with an on/off IE detection, or go deeper detecting version and other browsers?
Doesn't Opera do silent document.all in the same way that Moz does? 
No, I just tried this quick test in the address bar:
    javascript: alert( !!document.all )
Mozilla -> false
Opera -> true
 
Best regards
Mike