Closed Bug 843137 Opened 12 years ago Closed 7 years ago

nytimes.com doesn't recognize B2G UA as mobile

Categories

(Web Compatibility :: Site Reports, defect, P5)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: lmandel, Assigned: karlcow)

References

()

Details

(Whiteboard: [country-us] [contactready][serversniff][clientsniff])

Attachments

(1 file)

nytimes.com serves a desktop site to B2G. Bug 823364 added an UA override for this domain. The override should be removed once the domain serves mobile content to B2G. This bug tracks the evangelism for the site to recognize the B2G UA and the removal of the override at that time.
Blocks: nytimes.com
Whiteboard: [uaoverride]
The redirection is made server side to a different domain name.

It is not working for 
* Firefox for Android - Mozilla/5.0 (Android; Mobile; rv:18.0) Gecko/18.0 Firefox/18.0
* Firefox OS          - Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0


# Chrome on Nexus

→ http -v HEAD http://www.nytimes.com/ User-Agent:'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19' Accept:"text/html" 

HEAD / HTTP/1.1
Accept: text/html
Accept-Encoding: gzip, deflate, compress
Host: www.nytimes.com
User-Agent: Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19



HTTP/1.1 303 See Other
Connection: close
Content-Type: text/html; charset=iso-8859-1
Date: Wed, 24 Jul 2013 18:51:40 GMT
Location: http://mobile.nytimes.com/redirect?to-mobile=http://www.nytimes.com/&referrer=
Server: Apache



# Firefox OS

→ http -v HEAD http://www.nytimes.com/  User-Agent:'Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0' Accept:"text/html" 

HEAD / HTTP/1.1
Accept: text/html
Accept-Encoding: gzip, deflate, compress
Host: www.nytimes.com
User-Agent: Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0



HTTP/1.1 200 OK
Connection: close
Content-Length: 190134
Content-Type: text/html; charset=UTF-8
Date: Wed, 24 Jul 2013 18:52:34 GMT
Server: Apache
Set-Cookie: RMID=007f0100255051f022720054; Expires=Thu, 24 Jul 2014 18:52:34 GMT; Path=/; Domain=.nytimes.com;
Set-cookie: adxcs=-; path=/; domain=.nytimes.com
Set-cookie: adxcl=l*35c97=521ec73f:1; expires=Thursday, 24-Jul-2014 18:52:34 GMT; path=/; domain=.nytimes.com
Vary: Host
cache-control: no-cache
expires: Thu, 01 Dec 1994 16:00:00 GMT
pragma: no-cache



# Firefox for Android

→ http -v HEAD http://www.nytimes.com/  User-Agent:'Mozilla/5.0 (Android; Mobile; rv:18.0) Gecko/18.0 Firefox/18.0' Accept:"text/html" 

HEAD / HTTP/1.1
Accept: text/html
Accept-Encoding: gzip, deflate, compress
Host: www.nytimes.com
User-Agent: Mozilla/5.0 (Android; Mobile; rv:18.0) Gecko/18.0 Firefox/18.0



HTTP/1.1 200 OK
Connection: close
Content-Length: 191270
Content-Type: text/html; charset=UTF-8
Date: Wed, 24 Jul 2013 18:52:45 GMT
Server: Apache
Set-Cookie: RMID=007f01004cd651f0227d001d; Expires=Thu, 24 Jul 2014 18:52:45 GMT; Path=/; Domain=.nytimes.com;
Set-cookie: adxcs=-; path=/; domain=.nytimes.com
Set-cookie: adxcl=l*35c97=521ec73f:1; expires=Thursday, 24-Jul-2014 18:52:45 GMT; path=/; domain=.nytimes.com
Vary: Host
cache-control: no-cache
expires: Thu, 01 Dec 1994 16:00:00 GMT
pragma: no-cache
Assignee: nobody → kdubost
Contacted techfeedback@nytimes.com
Whiteboard: [uaoverride] → [uaoverride] [country-us] [sitewait]
There is no automatic redirection going on on nytimes.com - in Safari on iPhone they throw up a banner saying "Switch to the mobile version of NYTimes.com" at the top of the page. It seems the success criteria for being recognised as a mobile browser is that banner appearing?

Logic in http://js.nyt.com/js2/build/homepage/bottom.js - here you go:

var validUserAgent=((navigator.userAgent.match(/iPhone/i)!==null)||(navigator.userAgent.match(/iPod/i)!==null))

They also use sessionStorage to implement "do not show again":

$(document).ready(function(){if(validUserAgent&&hasMobileVersion&&noMobileCookie&&showBanner){$(mobileBannerHtml).insertBefore("#shell");if(hasSessionStorage()){sessionStorage.displayBanner=false;}}$(".bannerClose").click(function(){$("#mobileBanner").toggleClass("hidden");
hmm Interesting indeed.

On Opera Mobile, I get an automatic redirection to the mobile site.
On Android browser too.
You mean the Android "stock" browser? Interesting - so there may be some backend and some front-end logic involved. Did you try any http header studies?
Hallvord see Comment #1
the first request is with chrome 
Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19
# Safari + ipod

0. Erasing all data, cookies, etc on 
1. Entering http://nytimes.com/ 
2. Desktop site + banner for mobile. Click on the banner.
3. Next time, automatically redirected to the mobile site.

# Opera Mobile + Android

0. Erasing all data, cookies, etc on 
1. Entering http://nytimes.com/ 
2. Access to the Mobile site directly

# Firefox + Android

0. Erasing all data, cookies, etc on 
1. Entering http://nytimes.com/ 
2. Access to the Desktop site only
Hi guys,

I'm a member of the mobile web team here at NY Times. We don't handle the redirection side of things directly, but I'll take it up with the appropriate team.

Do you have a recommended user agent regex pattern for detecting Firefox for Android and B2G?
Fantastic Alastair. Appreciated.

(In reply to Alastair Coote from comment #9)
> Do you have a recommended user agent regex pattern for detecting Firefox for
> Android and B2G?

We usually recommend to be the most generic possible, to not be specific to Firefox but to embrace the mobile Web and make it less likely to break in the future. 

/.*mobi.*/i will catch Firefox for Android and B2G. It will also catch Opera Mobile and some others.

You might want to exclude tablet or ipad. Some devices have both terms. 

Do you use a commercial library or do you roll your own? We are asking because it is interesting to know what we should advocate for making the life of everyone simpler.

Thanks
Flags: needinfo?(alastair.coote)
forgotten to give the current UA used by devices.

User-Agent:'Mozilla/5.0 (Android; Mobile; rv:18.0) Gecko/18.0 Firefox/18.0'
User-Agent:'Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0'
I guess few sites get both [serversniff] and [clientsniff] badges, but nytimes.com qualifies ;-)
Whiteboard: [uaoverride] [country-us] [sitewait] → [uaoverride] [country-us] [sitewait][serversniff][clientsniff]
Status: NEW → ASSIGNED
(In reply to Karl Dubost :karlcow from comment #10)
> Do you use a commercial library or do you roll your own? We are asking
> because it is interesting to know what we should advocate for making the
> life of everyone simpler.
> 
> Thanks

We currently roll our own, but it's an area we've flagged as needing a lot of improvement in the future. We may well switch to an external library of some sort.

Just as an update, we are working on this - the changes have been committed and are in QA. I'll let you know when they are live.
Flags: needinfo?(alastair.coote)
I hope the same change will handle bug 753818 (mobile version of nytimes.com for Firefox on Android) :-)
Hi guys,

This change is now live. It does also include Firefox on Android (#753818) - I've tested it with both types and it seems to be working - any issues?
Fabulous. It is working! 
Thanls Alastair.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Blocks: 911260
Seems the "Firefox OS" part of this fix has gone missing. Firefox on Android still gets forwarded to the mobile site, Firefox OS doesn't.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Whiteboard: [uaoverride] [country-us] [sitewait][serversniff][clientsniff] → [country-us] [contactready][serversniff][clientsniff]
So, Alastair - could you have a look at it?
Status: REOPENED → NEW
Flags: needinfo?(alastair.coote)
I'm no longer on the mobile web team, but I will forward this on to them for review.
Flags: needinfo?(alastair.coote)
Thank you Alastair! Happy to answer any questions your colleagues might have :)
See Also: → 952778
This should have been fixed some time ago - I don't have an FFOS device to test with right now, but please let me know if it is not fixed.
The version which is being sent to Firefox for Android, would be perfectly working on Firefox OS.

I decided to try to contact again.
http://twitter.com/MozWebCompat/status/554494375950962689
Attached image nytimes.jpg
(In reply to Alastair Coote from comment #21)
> This should have been fixed some time ago - I don't have an FFOS device to
> test with right now, but please let me know if it is not fixed.

Alastair, this has not been fixed. Unfortunately. 
This screenshot is how the site is rendered in Gecko, as you can see it works perfectly when faking the UA.
Priority: -- → P5
Status: NEW → RESOLVED
Closed: 11 years ago7 years ago
Resolution: --- → WONTFIX
Product: Tech Evangelism → Web Compatibility
Component: Mobile → Site Reports
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: