Search

Hi Symphonians,

Saw this article and thought it may be of use to someone. I am primarily a UI developer so I am sure it may have it's use some way down the line http://ajaxian.com/archives/browser-detection-with-xslt. To quote from the origianal linked article :

"To clarify, a positive CC selection will allow only the IE’s specified to read the CSS, and a negative CC will exclude them from seeing it. The best, you don’t need anymore to include Microsoft proprietary CC’s for selecting CSS in your HTML!"

This could potentially eliminate the current polava we have to go through when adding stylesheets for IE. Maybe even passing variables for javascript through pages etc...

This is interesting, thanks Fazal. However at first glance it looks like this is for client-side XSL transformations (using the browser's XSLT engine), whereas Symphony does it XSL transformations on the server side (using LibXSLT/PHP).

I think we may be stuck with conditional comments and JavaScript object detection for some time! ;-)

at least you could use conditional comment classes to avoid seperate stylesheets for IE

Hey!

I created an extension that gets the browser info.

Check it out

NIce work degro :)

Where did this extension go ? :(

@into: some time ago I wrote a PHP client sniffer script to easily detect users' browser and OS, by parsing the UA string. You might want to check it out (it's far from being perfect, anyway): https://github.com/eKoeS/php-clientsniffer

Where did this extension go ? :(

I'd like to know also. :(

I made a comment on this thread but will copy it here to for those of you who are interested.

A lot of people seem to want browser detection so I quickly whipped this one up, https://github.com/superminge/browser_detection. If that is to peoples liking I will release officially. It detects browser, version, platform, mobile + more and outputs them in the parampool. The class I used has more detection than I used as well, so could be extended out to include said detection.

@touchstone - I clicked on the your link...

https://github.com/superminge/browser_detection

but it is no longer live.

Do you still have this code available?

hey sorry, this will be happening for a while... I changed my account name, you can find it here.

I haven't officially released it yet as I am still working on it. But it should be stable to use as is :-)

@touchstone - Awesome. Would you mind adding that the extensions list?

@touchstone quickly looking at Github this looks like a very nice, useful extension: thanks.

Just a tiny sidenote: it might be useful to briefly point out (in a ReadMe?) that "Browser Sniffing" is considered harmful

That is to say: IMHO it would be wise to advise against using browser sniffing for most things re: 'front-end functionality'… "Browser detection is an illusive task that is ultimately doomed to fail." according to the original writer of the browser.php script.

Re: front-end functionality it is much better to use "Object/feature Detection" instead… Use Conditional Comments for IE<10 and/or use modernizr.com

Finally: this is not to say I don't like this extension, only that IMHO it would be a pity if developers would use the browser-sniffing aspect of it for serious development ;)

I agree with the conditional statements for IE, this should not replace that method. And in no way should this extension be used to soley provide styles/scripts etc for specific browsers. That would quickly kill any traffic to your site as it wouldn't work for half the browsers out there.

But I don't see how browser sniffing can be considered harmful. As far as I'm aware, the useragent is very accurate. So the danger comes from the developer using it incorrectly. I will add a note to the readme outlining the best usecases.

And most of the solutions in those articles are JS based, which is even worse imo than serverside detection.

I think this extension is great for detecting tablets, mobiles etc for easily displaying/not displaying content that is too large or will cause the site to load slowly. Media queries are great n all but all you're doing is displaying none on large hero images etc, which means the browser still loads them.

That's just one example.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details