Recent activity
Subscribe to this feed
Jonathan L. replied on July 24, 2009 05:03 to the question "Flock 2.5 userAgent Value Issue" in Flock:
Hello all,
It may make sense to try and detect the presence of two strings, or of the presence of one and absence of another (such as when detecting Safari vs. Chrome), when trying to detect Flock. Of course, this is assuming the same Gecko build date is used on all versions of Flock 2.5...you'd probably need to maintain an array of Gecko build dates that Flock uses once 2.5.1 (or whatever) is released.
In JavaScript:
if (navigator.userAgent.indexOf("Flock") !== -1 || (navigator.userAgent.indexOf("Firefox") !== -1 && navigator.userAgent.indexOf("Gecko/2009051221") !== -1))
{
document.write("You're using Flock!");
}
else
{
document.writeln("You're not using Flock, so you're not cool.");
}
In PHP:
$userAgent = $_SERVER['HTTP_USER_AGENT'];
if (stripos($userAgent, 'flock') === true || (stripos($userAgent, 'firefox') === true && stripos($userAgent, 'gecko/2009051221') === true))
{
echo 'You're using Flock!';
}
else
{
echo 'You're not using Flock, so you're not cool.';
}
The JavaScript works, but I haven't tested the PHP. Some modifications may be necessary, as I'm doing it from memory.
Hope this helps!
Loading Profile...
