Results not always as expected with mobile user agent

So I was just running some simple scripted tests.

I would pass along a mobile user agent and then follow up with a navigate command. I’d expect a mobile website in return but that’s not always the case. Any thoughts?

Here’s an example:

http://www.webpagetest.org/result/130806_KK_13Q3/

That example looks like a mobile site that is stretched to 100% width. You probably also want to use setViewport to make the browser match a mobile aspect ratio and size.

That said, it still won’t catch ALL sites - if they are doing js feature detection of some kind.

Would it account for the inconsistencies when testing on the same site? I’m pretty new to web stuff in general but from a programming perspective, I’d think that I’d at least get consistent results. Would issues with javascript also cause something like that?
[hr]
I noticed when looking at the response headers on the instances that it Doesn’t work, ‘User-Agent’ in the ‘Vary’ header.

Are there usually inconsistencies when testing for redirection based on user-agent? Whether they used a regex or exact user agent matching, I’d, hopefully, get consistent results if I were to use the same user agent through my tests… right?

Hard to say without knowing the site specifically and how they are doing their detection. It’s certainly unusual but not impossible. It’s not uncommon to have a farm of servers powering a site so if a few are configured differently you could get different results with the exact same content (or the content itself could also change over time).