George and Lars on KHTML and WebKit
Posted by Maciej Stachowiak on Wednesday, December 13th, 2006 at 5:46 amLongtime KDE/KHTML developers Lars Knoll and George Staikos recently gave a presentation on KHTML and WebKit at Yahoo. Here’s a video of their presentation. They cover the early history of KHTML, as well as some of the newer things going on with WebKit and KHTML.
One point they mention a number of times is that many sites do a user agent check specifically for Safari. Safari sends the following User-Agent header: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3.
We strongly recommend looking for the AppleWebKit string and its version number, *not* for Safari. There are many other browsers and other applications based on WebKit which should have a near-identical web compatibility profile, both o the Mac and the other platforms. These include other Mac browsers, like OmniWeb, Shiira and Sunrise Browser. They include ports like the S60 browser. And there are non-browser apps like NetNewsWire or Dashboard that may still include live web content.
For the vast majority of cases, you want to check for the layout engine, not for the specific app.
Rant aside though, there’s a lot of interesting info in the video and you should all watch.
December 13th, 2006 at 10:07 am
On the point of agent checking: I’ve started using Shiira 2b2 and noticed yesterday that Google Calendars currently has this problem.
I get an “unsupported browser” message, but it works fine with Safari iteself. I sent an e-mail to their support desk about it and linked back to this post.
I’m sure they’ll fix it!
December 13th, 2006 at 2:12 pm
Why test for ‘AppleWebKit’ and not ‘KHTML’? I suppose Konquerer doesn’t have AWK in its agent string, so maybe that’s the reason — it would not be similar enough to Safari…?
December 13th, 2006 at 9:22 pm
[...] ; i George and Lars on KHTML and WebKit For the vast majority of cases, you want to check for the layout engine, not for [...]
December 13th, 2006 at 10:00 pm
History keeps repeating itself. Ever wonder why every browser’s user agent header starts with “Mozilla/5.0″?
December 14th, 2006 at 10:22 am
To bad folk don’t appear to read Apple’s Safari FAQ which recommends this…
http://developer.apple.com/internet/safari/faq.html#anchor2
December 15th, 2006 at 5:35 pm
The AppleWebKit string is where the version number of the framework is located.
December 17th, 2006 at 12:07 pm
You should check for AppleWebKit specifically because this is what Apple calls its own HTML rendering engine, which at some point in the future may drop KHTML for a home-grown core, KHTML may be sold/closed down and/or renamed or become so divergent from Web Kit that the two are not interchangeable.
The other reasons above also apply, specifically other non-Safari apps may use the Web Kit HTML rendering engine and checking for only AppleWebKit simplifies compatibility checking for *all* Web Kit-using apps.
I recently did a small programming job for a third-party website to enable Web Kit compatibility and specifically went the AppleWebKit route for all the reasons stated above e.g. non-Safari browsers, future-proofing.
December 18th, 2006 at 1:23 pm
Personally, I think sites should check for needed features and never assume that the user agent indicates that the features of the browser are what the developer thought they were when the page was published. I still see sites with six year old browser detection that are can only determine the difference between MSIE and NS 4.x.
Checking the agent string is not future proof. Checking for the feature you need is.
December 19th, 2006 at 3:38 am
User Agent string sniffing is pretty much braindead no matter what part of the string you might be looking for. Instead, you should as mcroft mentiones, check for features. What does the name of the browser matter? Isn’t what features it sports more interesting? Isn’t that really what you’re looking for with your UA string hack? I would recommend everyone doing UA sniffing to read the following:
http://dev.opera.com/articles/view/using-capability-detection/
January 10th, 2007 at 11:20 pm
[...] ’ Safari blog, make sure to also check out the video of KDE/KHTML developer-demigods Lars Knoll and George Staikos talking about KHTML and WebKit. If you’re a browser-technologies junkie (like me [...]