Created
April 9, 2012 07:44
-
-
Save devinrhode2/2342188 to your computer and use it in GitHub Desktop.
UA-Sniffing-FTW
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The internet abroad doesn't believe in UA sniffing. Maybe it | |
complicates things too much. I believe we can have a hybrid. | |
I thought hard about this. What the hell is so wrong about UA sniffing? | |
Ok, what if we don't have a user agent? I almost took the excuse: | |
"well, 90% of the time we'll have a UA (if not 100% of the time) | |
so, why worry about the 10%?" | |
EVERYBODY deserves the best experience their browser is capable of. | |
If they don't have a userAgent header, we can delay loading the majority | |
of resources for the page, and in javascript get the user-agent from navigator.userAgent | |
But I'm skipping over myself. The current argument against UA sniffing, | |
as I understand it, is that you make assumptions about what code will work. | |
This doesn't have to be, we can have a hybrid of the approach Modernizr takes. | |
Feature detection. It's the most reliable way to go. | |
**The proposal** | |
Run feature detects, and find out what shims/polyfills would be needed for various things. | |
Then, read navigator.userAgent, and send this shim list for this UserAgent | |
to a central database. Next time the server gets a request from this | |
exact UserAgent, it ALREADY knows what shims that browser needs, and | |
can also skip serving the feature detection tests. | |
Discuss on Hacker News: http://news.ycombinator.org/item?id=3816152 (or vote up) | |
Retweet and share if you support this idea! Holla @paul_irish and @modernizr if you feelz the need |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment