The Enterprise User Agent

« Return to Article
  • Anonymous 2012-04-24 09:40
  • the beholder 2012-04-24 09:41
    A senior is the right choice. You wouldn't want to bestow this mess upon a guy that is still far from retirement.

    And no frist for you
  • dkf 2012-04-24 09:46
    I see that Chris B's predecessor thought that he'd use regular expressions to turn one problem into (at least) 12… With bonus enterpriseyness from all that XML too.
  • PiisAWheeL 2012-04-24 09:47
    Obligitory comment about regex and the number of problems rising exponentially because of it.

    edit: damn you dkf :p
  • verisimilidude 2012-04-24 09:48
    And if I disable sending of the user agent string does that make me a secret agent?
  • PiisAWheeL 2012-04-24 09:50
    verisimilidude:
    And if I disable sending of the user agent string does that make me a secret agent?
    No it makes you a hidden agent.
  • TroelsL 2012-04-24 10:00
    This solution needs more service oriented architecture to facilitate social discovery.
  • foo 2012-04-24 10:01
    PiisAWheeL:
    verisimilidude:
    And if I disable sending of the user agent string does that make me a secret agent?
    No it makes you a hidden agent.

    Obviously part of a sleep()er cell.
  • Kryptus 2012-04-24 10:07
    I can see that a UserAgentParser.java is missing...
    and a bunch of hundreds more classes of course.
  • Kasper 2012-04-24 10:09
    The real WTF is the UnsupportedUserAgentException.
  • Rfoxmich 2012-04-24 10:17
    Wonder what the lynx configuration file looks like
  • CAPTCHA:abigo 2012-04-24 10:24
    PiisAWheeL:
    verisimilidude:
    And if I disable sending of the user agent string does that make me a secret agent?
    No it makes you a hidden agent.

    So I guess browsers that insist on sending the names of two different browsers ("Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)") must be double agents.


    (Admire the beauty of my string literal parenthization!)
  • Iscu 2012-04-24 10:36
  • uns 2012-04-24 10:37
    TroelsL:
    This solution needs more service oriented architecture to facilitate social discovery.


    UserAgendParsedLetsPostToTwitterAboutIt.class ?
  • Strolskon 2012-04-24 10:41
    Someone clearly needs to create a SaaS user-agent detection infrastructure to harness the power of the cloud and synergize the relationship between browsers and content-authoring and delivery systems.
  • PiisAWheeL 2012-04-24 10:55
    Strolskon:
    Someone clearly needs to create a SaaS user-agent detection infrastructure to harness the power of the cloud and synergize the relationship between browsers and content-authoring and delivery systems.
    With a comment like that my guess is that you work in a marketing department somewhere.
  • Strolskon 2012-04-24 10:56
    uns:
    TroelsL:
    This solution needs more service oriented architecture to facilitate social discovery.


    UserAgendParsedLetsPostToTwitterAboutIt.class ?


    Your User Agent is: "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120403211507 Firefox/12.0".


  • db 2012-04-24 11:10
    I'm not sure if I get it right.

    The Firefox XML takes care of parsing and hence the wonder "why have so many classes and interfaces?"
  • WTF-land braver 2012-04-24 11:16
    the beholder:
    A senior is the right choice. You wouldn't want to bestow this mess upon a guy that is still far from retirement.
    I agree. Work too long on this crap and you'll end up insane
  • ¯\(°_o)/¯ I DUNNO LOL 2012-04-24 11:19
    Anonymous:

    You posted the wrong Bill...

  • Kasper 2012-04-24 12:07
    CAPTCHA:abigo:
    So I guess browsers that insist on sending the names of two different browsers ("Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)") must be double agents.
    According to the protocol specification, the part in parenthesis is just a comment, which doesn't actually identify anything. So above user agent contains only one browser name, which is Mozilla/5.0. That is not to say it actually is Mozilla/5.0, it might be some other browser spoofing a Mozilla/5.0 user-agent header.
  • adiener 2012-04-24 12:12
    I feel physically ill after reading this. Seriously.
  • Tim B-L 2012-04-24 13:13
    The web is about connecting everything to everything, and everyone to everyone.

    If you're even looking at the User Agent string you're doing it wrong!
  • brazzy 2012-04-24 13:16
    Hm... could it be that all those Java classes and interfaces are actually a generated XML binding?

    That would make it a bit less of a WTF: Someone thought that right way to approach this was to pour all knowledge about user agent strings into XML configuration files (to make it, you known, configurable! Yay for Softcoding!), then defined a schema for that and used a binding generator.

    Yeah, it's *still* a pretty dumb way to do it.
  • Larry 2012-04-24 13:20
    When all you have is a hammer, everything looks like a nail.

    When all you have is an XML-autogenerated-Java lasagna architecture, everything looks like an enterprise!
  • brazzy 2012-04-24 13:22
    Iscu:

    You know, I actually like Java and am pretty sick of all the cheap bashing, but this is just too damn funny (and too often true).

  • Myself 2012-04-24 13:42
    Guys, you are all missing the point. Imagine you are a consultant who wants to squeeze out a couple of extra paid weeks but the project is almost done. You convince the customer that you need of course to figure out the user agent for customized UI rendering. Everybody knows that!!!! You could probably do that in a couple of hours but you need the money so you try to find out how much bloat you could create for simple string parsing. A bit like the "1+1=2 in scientific representation" joke. Either that or Chris B work at IBM.
  • Jay 2012-04-24 14:27
    CAPTCHA:abigo:
    PiisAWheeL:
    verisimilidude:
    And if I disable sending of the user agent string does that make me a secret agent?
    No it makes you a hidden agent.

    So I guess browsers that insist on sending the names of two different browsers ("Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)") must be double agents.


    (Admire the beauty of my string literal parenthization!)


    I thought a Double agent was the opposite of an Integer agent.
  • Jay 2012-04-24 14:28
    PiisAWheeL:
    Strolskon:
    Someone clearly needs to create a SaaS user-agent detection infrastructure to harness the power of the cloud and synergize the relationship between browsers and content-authoring and delivery systems.
    With a comment like that my guess is that you work in a marketing department somewhere.


    You need to add something about "utilizing paradigms".
  • YF 2012-04-24 14:41
    I needed to do browser discovery for logging purposes only, but I'm not skilled enough to create this masterpiece...

    ...so I just coded this in Java: http://www.quirksmode.org/js/detect.html

    Time consumed: ~1h

    Fail?
  • big picture thinker 2012-04-24 14:55
    Tim B-L:
    The web is about connecting everything to everything, and everyone to everyone.

    If you're even looking at the User Agent string you're doing it wrong!


    The User Agent String is essential to check to determine what content to send.

    You wouldn't want to send a full desktop-based website (800+ pixel wide screen) with high resolution images to an Android or iPhone, would you?

    It's also useful in serving correct CSS. You don't necessarily have to put hacks in your CSS if you simply send a different stylesheet for msie than for gecko/webkit.
  • J 2012-04-24 15:15
    YF:
    I needed to do browser discovery for logging purposes only, but I'm not skilled enough to create this masterpiece...

    ...so I just coded this in Java: http://www.quirksmode.org/js/detect.html

    Time consumed: ~1h

    Fail?

    Yes. That code can't detect the Android browser. It calls it 'Mozilla'.
  • apoc9 2012-04-24 15:17
    It's nice when someone re-implements SDK Collection, Pattern, Properties, String, Boolean. Plus cache, because we need optimization.
  • apoc9 2012-04-24 15:24
    YF:
    I needed to do browser discovery for logging purposes only, but I'm not skilled enough to create this masterpiece...

    ...so I just coded this in Java: http://www.quirksmode.org/js/detect.html

    Time consumed: ~1h

    Fail?


    Sorry to bring it to you JavaScript != Java.
  • Ken B. 2012-04-24 15:25
    big picture thinker:
    Tim B-L:
    The web is about connecting everything to everything, and everyone to everyone.

    If you're even looking at the User Agent string you're doing it wrong!
    The User Agent String is essential to check to determine what content to send.
    Why do you feel the need to send different content to different user agents? I've seen websites that refuse to serve up anything to "wget" unless I tell it to pretend to be something else.

    You wouldn't want to send a full desktop-based website (800+ pixel wide screen) with high resolution images to an Android or iPhone, would you?
    Ah... You want to have a "mobile" version? Use CSS.

    It's also useful in serving correct CSS. You don't necessarily have to put hacks in your CSS if you simply send a different stylesheet for msie than for gecko/webkit.
    Oh, so you know about using CSS for this? Given that the browser already knows what type of browser it is, along with the destination media, why not let it pick the correct CSS, rather than writing such ugly things that try to parse every possible (and every future) user agent string? Yes, you sometimes need to use CSS hacks to handle "broken" browsers, but those have already been written in clear, concise forms.
  • Tim B-L 2012-04-24 15:36
    big picture thinker:
    Tim B-L:
    The web is about connecting everything to everything, and everyone to everyone.

    If you're even looking at the User Agent string you're doing it wrong!


    The User Agent String is essential to check to determine what content to send.

    You wouldn't want to send a full desktop-based website (800+ pixel wide screen) with high resolution images to an Android or iPhone, would you?

    It's also useful in serving correct CSS. You don't necessarily have to put hacks in your CSS if you simply send a different stylesheet for msie than for gecko/webkit.
    If you're counting pixels you're doing it wrong! A user-agent should be able to resize images so they fit, or let you scroll. Your HTML should also be able to resize so it fits. If it can't, please go shoot yourself now for me, please please!!! YOU ARE THE PROBLEM!!!!!!!!
  • brazzy 2012-04-24 15:57
    Tim B-L:
    If you're counting pixels you're doing it wrong! A user-agent should be able to resize images so they fit, or let you scroll. Your HTML should also be able to resize so it fits. If it can't, please go shoot yourself now for me, please please!!! YOU ARE THE PROBLEM!!!!!!!!


  • XMLBasher 2012-04-24 16:08
    XML is like violence. If it's not solving all your problems, you're not using enough of it.
  • bad_management 2012-04-24 16:13
    No! Management where I work insist on "1+1>2". They literally told us that in a presentation! So your argument is invalid.
  • KattMan 2012-04-24 16:40
    bad_management:
    No! Management where I work insist on "1+1>2". They literally told us that in a presentation! So your argument is invalid.


    For large values of 1 it does...
    1.4+1.4=2.8 rounded off to integers 1+1=3
  • ubersoldat 2012-04-24 16:45
    You're using Safari 5 on an unknown OS!


    lovely
  • ubersoldat 2012-04-24 16:49
    J:
    YF:
    I needed to do browser discovery for logging purposes only, but I'm not skilled enough to create this masterpiece...

    ...so I just coded this in Java: http://www.quirksmode.org/js/detect.html

    Time consumed: ~1h

    Fail?

    Yes. That code can't detect the Android browser. It calls it 'Mozilla'.


    And today's lesson is, don't show your code around here with pride, it'll be bashed to ashes.
  • ThePants999 2012-04-24 17:06
    This is obviously utterly ridiculous, and its creation was a massive waste of time, with benefits nowhere near justified by its cost.

    But were I developing something on top of it, it looks like it'd be pretty handy!
  • Yaos 2012-04-24 17:09
    Pretty dumb in my book, how are you supposed to add new browsers? I would have used regex to parse the user string, send that off to an MSSQL database (must be version 6.32532.32533 because it relies on an obscure bug that only exists in this exact version), and then a series of stored procedures will compare each bit of the user string and compare it to every bit of information in the database. Once it determines if the user is using Internet Explorer (can't use other browsers, takes too long to populate the database by hand) it gets wrapped up in XML and sent back to be regexed again and then a for loop runs through each entry in the database and compares it against the parsed data.
  • x 2012-04-24 18:21
    Tim B-L:
    If you're counting pixels you're doing it wrong! A user-agent should be able to resize images so they fit, or let you scroll. Your HTML should also be able to resize so it fits. If it can't, please go shoot yourself now for me, please please!!! YOU ARE THE PROBLEM!!!!!!!!

    Amazingly, HTML can be used for things other than web pages.
  • Nails on a chalkboard 2012-04-24 20:46
    Reminds me of "Enterprise FizzBuzz"
    http://codermike.com/if-something-is-worth-doing
  • Gunslinger 2012-04-24 22:33
    x:
    Tim B-L:
    If you're counting pixels you're doing it wrong! A user-agent should be able to resize images so they fit, or let you scroll. Your HTML should also be able to resize so it fits. If it can't, please go shoot yourself now for me, please please!!! YOU ARE THE PROBLEM!!!!!!!!

    Amazingly, HTML can be used for things other than web pages.


    Name an application that requires pixel-counting.
  • x 2012-04-24 23:24
    Gunslinger:
    x:
    Tim B-L:
    If you're counting pixels you're doing it wrong! A user-agent should be able to resize images so they fit, or let you scroll. Your HTML should also be able to resize so it fits. If it can't, please go shoot yourself now for me, please please!!! YOU ARE THE PROBLEM!!!!!!!!

    Amazingly, HTML can be used for things other than web pages.


    Name an application that requires pixel-counting.

    One for which I am responsible. Some applications run in the context of other applications, and therefore do not have the luxury of defining how they may be constructed. In this case, UI is done in HTML, but that doesn't change the specs.
  • smilr 2012-04-24 23:30
    big picture thinker:

    You wouldn't want to send a full desktop-based website (800+ pixel wide screen) with high resolution images to an Android or iPhone, would you?


    Please stop making websites.

    I specifically jailbroke my iOS devices so that I can put in the UAFaker addon to mobilesafari specifically so I can claim to be a desktop browser in order to prevent what you advocate.

    I have zooming / panning capabilities in my mobile browser that permit me to efficiently view the normal or desktop versions of websites. I prefer them to the "mobile" stripped down versions of websites.

    When in ladscape mode my screen resolution is above 800px wide anyhow and my eyesight is good enough that I can usually read text rendered that small on my phone's screen, and zoom in when necessary anyhow.

    Stop dumbing down the internet. Damnum
  • Aussie Contractor 2012-04-25 00:01
    smilr:
    big picture thinker:

    You wouldn't want to send a full desktop-based website ..... with high resolution images to an Android or iPhone .....

    ..... I have zooming / panning capabilities in my mobile browser that permit me to efficiently view the normal or desktop versions of websites. I prefer them to the "mobile" stripped down versions of websites.....


    My web apps all have a mobile version detected by the server.

    The download size to fully display a page in the "desktop" version is 125kb and on the "mobile" version it is <2kb. When you are standing 450Km from the nearest town using my app on your Nokia 6550 you will thank me.

    Oh, and don't worry about modding the OS on your phone and install any special app, there is a link at the bottom which says "Show Desktop Site"

    And for the record I use a script from here which took 3 minutes to implement. I wish I had billed a client 3 weeks and created the masterpiece above.
  • pnellesen 2012-04-25 01:13
    Strolskon:
    Someone clearly needs to create a SaaS user-agent detection infrastructure to harness the power of the cloud and synergize the relationship between browsers and content-authoring and delivery systems.

    My eyes! The goggles, they do NOTHING!
  • Anomymoose 2012-04-25 01:26
    CSS/html has you covered.
    http://www.w3.org/TR/css3-mediaqueries/
    Server different sheets, or sections of a style sheet based on media type / screen size. No need to sniff for the user-agent.
  • will 2012-04-25 02:32
    Yet another win for those who have replaced thier user agent string with "Commodore 64"
  • tablet user 2012-04-25 03:27
    big picture thinker:

    You wouldn't want to send a full desktop-based website (800+ pixel wide screen) with high resolution images to an Android or iPhone, would you?


    Please don't ever implement web sites.

    I often use my Android tablet to browse the web. Because of geniuses like you I get content designed pixel perfectly for mobile phones on my device that is _1280 pixels wide_. Normal websites would be perfectly usable without any scrolling but I'm served some dumbed down crap that looks awful on that screen.

    Thanks, web developers.

  • TheRider 2012-04-25 04:04
    It seems to be a very difficult concept to grasp for graphic designers and web developers that the_web_is_not_a_sheet_of_paper. Being a programmer who frequently has to build the web sites that such a graphic genius has designed, I keep having to tell her that she shouldn't bother to design a site for letter-sized paper, nor for 1280x1024 pixels, nor for any fixed amount of pixels, for that matter. Then she looks at me with a blank stare. But the monitor on her desk has 1280x1024 pixels. And the world revolves around her.
  • Soske 2012-04-25 04:05
    I didn't replace it, in came that way and in PETSCII furthermore.
  • L. 2012-04-25 04:17
    J:
    YF:
    I needed to do browser discovery for logging purposes only, but I'm not skilled enough to create this masterpiece...

    ...so I just coded this in Java: http://www.quirksmode.org/js/detect.html

    Time consumed: ~1h

    Fail?

    Yes. That code can't detect the Android browser. It calls it 'Mozilla'.

  • L. 2012-04-25 04:18
    ubersoldat:
    You're using Safari 5 on an unknown OS!


    lovely

    Safari is TRWTF . and its shipped with the worst OS of all times, where one does not simply maximize a window.
  • L. 2012-04-25 04:24
    smilr:
    big picture thinker:

    You wouldn't want to send a full desktop-based website (800+ pixel wide screen) with high resolution images to an Android or iPhone, would you?


    Please stop making websites.

    I specifically jailbroke my iOS devices so that I can put in the UAFaker addon to mobilesafari specifically so I can claim to be a desktop browser in order to prevent what you advocate.

    I have zooming / panning capabilities in my mobile browser that permit me to efficiently view the normal or desktop versions of websites. I prefer them to the "mobile" stripped down versions of websites.

    When in ladscape mode my screen resolution is above 800px wide anyhow and my eyesight is good enough that I can usually read text rendered that small on my phone's screen, and zoom in when necessary anyhow.

    Stop dumbing down the internet. Damnum


    stop dumbing down the internet, said the iOS user... Did you know you could majorly improve your browsing experience by removing safari and installing a real browser ?
  • L. 2012-04-25 04:29
    TheRider:
    It seems to be a very difficult concept to grasp for graphic designers and web developers that the_web_is_not_a_sheet_of_paper. Being a programmer who frequently has to build the web sites that such a graphic genius has designed, I keep having to tell her that she shouldn't bother to design a site for letter-sized paper, nor for 1280x1024 pixels, nor for any fixed amount of pixels, for that matter. Then she looks at me with a blank stare. But the monitor on her desk has 1280x1024 pixels. And the world revolves around her.


    Now now, don't go asking all those fail webdevs to do a fully adaptable website design, they don't have any button for that in their dreamweavers / wordpress / joomla noobtoys.

    Besides, monitor res matters not when a luser installs every available toolbar...
  • fixed 2012-04-25 05:45
    Jay:
    PiisAWheeL:
    Strolskon:
    Someone clearly needs to create a SaaS user-agent detection infrastructure to harness the power of the cloud and synergize the relationship between browsers and content-authoring and delivery systems.
    With a comment like that my guess is that you work in a marketing department somewhere.


    You need to add something about "utilizing paradigms".


    And go into more depth on how the broad specifics will be actioned going forward.
  • Lord0 2012-04-25 06:39
    Needs more XML
  • frenzic 2012-04-25 08:43
    Great. Did that right away.
  • frenzic 2012-04-25 08:45
    will:
    Yet another win for those who have replaced thier user agent string with "Commodore 64"


    Great. Did that right away.
  • C-J 2012-04-25 09:14
    You are all wrong, you use 960.gs and adapt.js. Works like a charm.
  • Randompseudonym 2012-04-25 10:23
    L.:
    Besides, monitor res matters not when a luser installs every available toolbar...


    That's what LARTs are for.
  • ybred 2012-04-25 10:56
    TroelsL:
    This solution needs more service oriented architecture to facilitate social discovery.


    I'm pretty sure I heard this exact same line from marketing.
  • Shinobu 2012-04-25 11:30
    Tim B-L:
    If you're counting pixels you're doing it wrong! A user-agent should be able to resize images so they fit, or let you scroll. Your HTML should also be able to resize so it fits. If it can't, please go shoot yourself now for me, please please!!! YOU ARE THE PROBLEM!!!!!!!!
    THIS. Think about it. The latest iPhone has 640 pixels horizontal resolution. If your content doesn't adapt to that, it will look crappy on a lot of desktops as well, especially if the user has the browser window open side-by-side with some other window, like a word processor or something.
    The web is not a piece of paper, and a web page must adapt to whatever space is available. And checking the user agent won't tell you that.
  • Jack 2012-04-25 12:10
    Aussie Contractor:
    The download size to fully display a page in the "desktop" version is 125kb and on the "mobile" version it is <2kb. When you are standing 450Km from the nearest town using my app on your Nokia 6550 you will thank me.
    Perhaps if you give everyone that <2kb version they'd thank you too.
    Aussie Contractor:
    My web apps all have a mobile version detected by the server.
    Nice. So you have to test everything twice, right? Oops. There's more than one "mobile" platform! Dammit! Now we're testing everything 10 times. And next year, when the new $COOL_THING comes out, we'll have to test again. Maybe even rewrite. Sounds like perpetual employment for something that should have been done only once. Sweet revenue stream for you, sucky costs for your employers and sucky experience for your users.

    Oh please can't we go back to the good old days when everyone used Windows 95 on an 800x600 screen and the only way to communicate with someone else was to email them a Word document?
  • Jay 2012-04-25 13:06
    In the early days of the web, the server sent what was basically a stream of text, with some markup and maybe a few images, and the browser laid it out to fit in the available space. One of the beauties of the system was that the person who created teh content didn't know or care what browser the user had, what their screen resolution was, what size the browser window was, etc. The browser just scaled and flowed text and made it fit.

    Then some genius came along and decided that we needed to have a "richer experience", by which they meant that the server should specify all the formatting details.

    The advantage and wonder of this scheme is that I now routinely visit web sites that have all the content in a narrow band in the middle, with big empty space on either side. Or worse, a web page assumes a screen wider than my browser window, so text falls off the edge and I have to constantly scroll left and right. As a developer trying to accomodate users who want these fixed layouts, getting the content right is now about 30% of the job. The other 70% is tinkering with layout to get everything position on the page just exactly the way they want, with all the fancy borders and icons and dancing bear graphics.

    But all this inconvenience does not come without offsetting advantages. Now we can get exactly the right number of words on each line. Users are no doubt incredibly impressed by the beauty of the border we put around a block of text and how those findly rounded corners all meet just right. Why, I bet if we had square corners on the "Submit Order" button instead of rounded corners, they'd just exit our web site in disgust and go buy from someone else.

    </rant>
  • Real Tim Berner Lee 2012-04-25 13:12
    Tim B-L:
    The web is about connecting everything to everything, and everyone to everyone.

    If you're even looking at the User Agent string you're doing it wrong!

    Faker!! I am real Tim Berner Lee!

    But even though you are faker, you are right about not looking at User Agent string. Important things are browser capabilities and window width, both of which can be tested.

    Also to consider: data transfer to mobile is slow and it's a good idea to avoid sending large images if you will only show small ones.
  • OccupyWallStreet 2012-04-25 14:53
    smilr:
    I specifically jailbroke my iOS devices so that I can put in the UAFaker addon to mobilesafari specifically so I can claim to be a desktop browser in order to prevent what you advocate.


    There are tons of web browsers available for iOS that let you change the user-agent, no need to jailbreak for that (a lot of features that require jailbreaking are now standard or have alternatives in the app store).

    And most mobile sites had "view full site" links that disabled the mobile version if you really needed it. But there are few of them I really use.

    You'd have to take a LOT of convincing me that say, the full version of amazon.com is far better than the mobile version. Less tapping/scrolling around and zooming, for starters, neverminding that the mobile version loads 10 times quicker.
  • Sanjiiv 2012-04-25 14:54
    It would probably be easier (and just as enterprisey) to write your own XML parser which converts the properties file to a giant "case / switch" at compile-time.
  • The REAL real Tim Berners-Lee 2012-04-25 19:36
    Real Tim Berner Lee:
    Faker!! I am real Tim Berner Lee!

    That's funny, i'd have thought the real Tim would be able to spell his own name.
  • MarkJ 2012-04-25 20:54
    There's a class missing. Where's UserAgentAntiPattern.java?
  • Echber the Other 2012-04-26 00:39
    All this talk about resolution-independence and not checking UAs is missing something that's just a little bit important: size or density-independence. A 1-inch button on a big 800x600 CRT isn't a 1-inch button on a 3.5" phone. Mobile layouts tend to have big, 'friendly' interfaces for a reason.
  • L. 2012-04-26 01:48
    Echber the Other:
    All this talk about resolution-independence and not checking UAs is missing something that's just a little bit important: size or density-independence. A 1-inch button on a big 800x600 CRT isn't a 1-inch button on a 3.5" phone. Mobile layouts tend to have big, 'friendly' interfaces for a reason.


    Indeed density is the biggest issue these days, with more tablets and phones using 1080p+ resolutions everyday. The only thing that would make any sense today is considering device type + physical size of browser window + have a resolution independent layout for each category. even more fail for the web coding world.
  • L. 2012-04-26 01:53
    Echber the Other:
    All this talk about resolution-independence and not checking UAs is missing something that's just a little bit important: size or density-independence. A 1-inch button on a big 800x600 CRT isn't a 1-inch button on a 3.5" phone. Mobile layouts tend to have big, 'friendly' interfaces for a reason.


    I forgot.. I read this yesterday

    http://www.html5rocks.com/en/mobile/cross-device/

    there's a piece about how high res touch devices report 50% res and render everything at twice the size, thus yielding the same one inch button on both ipad 2 and 3.
  • pure 2012-04-26 08:50
    Dunno if anyone posted this already, but if there is a justitifaction, maybe this is it:

    http://webaim.org/blog/user-agent-string-history/

    TRWTF?
  • Lockwood 2012-04-26 10:01
    frenzic:
    will:
    Yet another win for those who have replaced thier user agent string with "ZX Spectrum"


    Great. Did that right away.


    FTFY

    transverbero. I seem to have transverboed back to not being signed in.
  • Kuba 2012-04-29 17:06
    Jay:
    Then some genius came along and decided that we needed to have a "richer experience", by which they meant that the server should specify all the formatting details.

    The advantage and wonder of this scheme is that I now routinely visit web sites that have all the content in a narrow band in the middle, with big empty space on either side.
    I hate to be the harbinger of bad news, but it truly, awesomely sucks to read stuff that's too wide. Get a published book and see how many words there are on a line of prose. Then look on a random webpage, on a line that has prose in the same language. If there are significantly more words, it becomes very hard to read. I don't mind the "narrow strip" formats as long as they maintain a certain number of words per line.
  • CZeke 2012-05-01 20:34
    If you're Doing It Wrong just by looking at the user-agent string, what's it there for?
  • pikzen 2012-05-09 06:20
    C#:

    String response = new StreamReader(con.GetResponseStream()).ReadToEnd();


    Java:

    BufferedReader br = new BufferedReader(
    new InputStreamReader(
    new InputStream(con.getInputStream())); // I've seen less wrapping on a gift
    String response = "";
    String lineRead = br.readLine();

    while (lineRead != null) {
    response = response + "\n" + lineRead;
    lineRead = br.readLine();
    }
    // etc.


    Most of the bashing is justified. Stop being so goddamn verbose, Java
  • pikzen 2012-05-09 06:26
    Nice. So you have to test everything twice, right? Oops. There's more than one "mobile" platform! Dammit! Now we're testing everything 10 times. And next year, when the new $COOL_THING comes out, we'll have to test again. Maybe even rewrite. Sounds like perpetual employment for something that should have been done only once. Sweet revenue stream for you, sucky costs for your employers and sucky experience for your users.


    To be fair, most desktop designs do not go well on a mobile browser. Even if the resolution is good enough, the size of the screen is a problem.
  • waterloomatt 2012-06-06 07:38
    LOL - great!!
  • db 2012-08-02 10:24
    String response = org.apache.commons.io.IOUtils.toString(con.getInputStream());
    //or pick any of at least 3 other libs to do it..