[TYPO3-core] FYI24: #10649: Add user agent detection for FireFox, Camino, Safari, Chrome and iPhone

Dmitry Dulepov dmitry at typo3.org
Tue Mar 10 14:40:18 CET 2009


Hi!

Benjamin Mack wrote:
> you're aware that this might break current typoscript conditions?

I think it can. yes. But having conditions on modern browser is quite important too.

> I have a site with TSconfig conditions to match all Mozilla5 browsers:
> 
> [browser = netscape]&&[version > 4]
>     ...
> [GLOBAL]
> 
> I just had three browsers running, I got this:
> 
>  * Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.19)
> Gecko/20081212 Camino/1.6.6 (like Firefox/2.0.0.19)
>  * Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b2)
> Gecko/20081201 Firefox/3.1b2
>  * Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us)
> AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16

I do not know the exact use case there, so I cannot tell how it can be handled :( For example, this "netscape" condition can become virtual: it will match also for FireFox, Camino and Safari. Will this be a solution?

> So they'd all match these options. Also, it is currently possible to
> check for useragents like this:
> 
>       [useragent = *Safari*]
> 
> Right?

I do not know if it is possible. Even if it is possible, this fact is  not documented, therefore should not be used ;)

http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/4/#id4143849

> So: Should we provide a note in the installer, in the NEWS.txt?

NEWS.txt definitely!

> One more thing: We also need to update the "Pending Documentation" page
> once this is commited.

Sure. This happens only after the commit, not before.

> 
> Also by reviewing, you do a:
>   $tmp = strstr($useragent,'FireFox/');
> should be a "stristr" for that :)

Hm. Locally I have stristr. If it is a strstr in the patch, than this patch is not latest. Sorry for that :(

> Additionally (which is not really an issue for this RFC), we
> could/should use "strpos !== false" in the checks instead of strstr, so
> it's faster?

I do not have any benchmarks but I do not it will significally speed up processing when TypoScript is parsed :)

-- 
Dmitry Dulepov
TYPO3 core team
http://dmitry-dulepov.com/


More information about the TYPO3-team-core mailing list