Detection of current major browsers

thread: 6 messages  |  last: about 3 years ago  |  started: sunday, september 7, 2008, 1:31 am pdt


#1  |  Fernando Lordán (Barcelona, CAT, Spain) Spain
Sunday, September 7, 2008, 1:31 AM PDT

Since I have no way to add code myself, I make the request and provide the patch at the same time.
<http://www.qcodo.com/downloads/item.php/218>
<http://zcodo.com/content/support-current-browsers>

This patch is based in Zcodo 0.4.43.1 and allows Qcodo to correctly detect the next browsers (I've included all the major browsers since the MSIE 6 epoch):

- MS Internet Explorer: 6, 7 and 8.
- Firefox: 1, 1.5, 2 and 3.
- Safari: 2, 3 and 4.
- Opera: 7, 8 and 9.
- Konqueror: 3 and 4.
- Chrome: 0 beta and the future 1 stable.

It also detects the client operative system (but not its version):
- Windows
- Linux
- Macintosh

I've only patched Qcodo to detect previously undetected browsers (as flagging them as “Unsupported” is totally unuseful), but of course this doesn't mean that I've patched the entire Qcodo framework to support them. Qcodo unsupported browsers keep unsupported, but now they're correctly detected so we can add support to them.

#2  |  VexedPanda (Calgary, AB) Canada
Tuesday, September 16, 2008, 3:40 PM PDT

Thank you for the contribution. Personally, I'm actually against detecting browsers though, as I can't see it serving any useful purpose. (Apart perhaps from statistics gathering specifically about browsers used, in which case you'd be better off storing the user agent string itself.)

Any code that must change based on browser behavior should be written to change based off of the behavior in question, not based on some arbitrary string.

#3  |  Fernando Lordán (Barcelona, CAT, Spain) Spain
Friday, December 12, 2008, 6:14 PM PST

I agree with the approach based on browser features better than in browser detection. But I've stumbled upon cases where these code decisions must be done in the server side (when rendering controls based on very nested layers, when rendering runtime styles to position elements, and specially when including incompatible Javascript modules or Javascript behaviours based on bubbling or capturing DOM2 events). In these cases you can't rely on broser features, but just on the browser agent string (not ideal, but it's the only way).

So I've found necessary to sometimes base the rendering flow in the detected browser. In fact that's the reason because I decided to include support for the detection of all major browsers.

Also, from a feature perspective it's useful. And it doesn't hurt.

#4  |  marcosdsanchez (Buenos Aires, Argentina) Argentina
Monday, December 15, 2008, 8:23 AM PST

Fernando, your patch was added to QCubed RC1. Please checkout the sources, you can see your code implemented there.

Please let us know if you find any bug on the implementation.

Cheers,

Marcos

#5  |  Fernando Lordán (Barcelona, CAT, Spain) Spain
Tuesday, December 23, 2008, 5:43 AM PST

Buenos d

#6  |  marcosdsanchez (Buenos Aires, Argentina) Argentina
Tuesday, December 23, 2008, 7:50 AM PST

Fernando,

I was mistaken. This is included in trunk. Not in the RC1 version.

This is the QApplicationBase in trunk
<http://trac.qcu.be/projects/qcubed/browser/trunk/wwwroot/includes/qcodo/_core/framework/QApplicationBase.class.php>

and the qcodo.js file

<http://trac.qcu.be/projects/qcubed/browser/trunk/wwwroot/assets/js/_core/qcodo.js>

Please note that qc_packed.js is not updated as this release is not final yet.

Feel free to submit any tickets if you feel the implementation is wrong.

Cheers,

Marcos



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.