Merge lp:~bfiller/webbrowser-app/fix-1227941 into lp:webbrowser-app

Proposed by Bill Filler
Status: Merged
Approved by: Bill Filler
Approved revision: 346
Merged at revision: 349
Proposed branch: lp:~bfiller/webbrowser-app/fix-1227941
Merge into: lp:webbrowser-app
Prerequisite: lp:~osomon/webbrowser-app/ua-override-domains
Diff against target: 17 lines (+2/-0)
1 file modified
src/Ubuntu/Components/Extras/Browser/ua-overrides.js (+2/-0)
To merge this branch: bzr merge lp:~bfiller/webbrowser-app/fix-1227941
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Bill Filler (community) Approve
Olivier Tilloy Approve
Review via email: mp+187643@code.launchpad.net

Commit message

add user-agent override for mail.google.com

Description of the change

add an user-agent override for mail.google.com such that gmail renders correctly like it does on android and iphone. Note, we only want to apply this override specifically for mail.google.com so this other MR is a prerequiste:
https://code.launchpad.net/~osomon/webbrowser-app/ua-override-domains/+merge/187561

also note that we only want this override for mobile, not desktop, and that is the reason for the mobile substituion rather than a complete string override. Maybe there is an easier way using regexp but I didn't know how to do it.

Basically the default string is this:
Mozilla/5.0 (Ubuntu; Mobile) WebKit/537.21

And this is required for mail.google.com:
"Mozilla/5.0 (Ubuntu; Linux; Android 4.2.2) AppleWebKit/537.21 Mobile Safari/537.21"

Hence my replacement of "Mobile) WebKit/537.21" with "Linux; Android 4.2.2) AppleWebKit/537.21 Mobile Safari/537.21"

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

It appears there’s a formatting issue, the override definition is on two lines, can you make it a one-liner?

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

I played a bit with the UA string you’re proposing, to try and reduce it to a simpler form, and here is what I came up with:

    "mail.google.com": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],

Tested on Galaxy Nexus, I’m getting the same content as Chrome on Android.

Revision history for this message
Bill Filler (bfiller) wrote :

updated per Olivier's suggestion, works well. Also added an override for nytimes.com to server up mobile site.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Looks good, and I verified that after clearing the browser’s cache, the nytimes.com override gets us the mobile version.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

try again

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

try again

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/Extras/Browser/ua-overrides.js'
2--- src/Ubuntu/Components/Extras/Browser/ua-overrides.js 2013-08-29 10:49:43 +0000
3+++ src/Ubuntu/Components/Extras/Browser/ua-overrides.js 2013-09-26 13:25:07 +0000
4@@ -37,6 +37,7 @@
5 // Android as a reference.
6
7 var overrides = {
8+ "mail.google.com": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
9 "google.com": ["Mobile", "Android; Mobile"],
10 "youtube.com": ["Mobile", "Android; Mobile"],
11 "yahoo.com": ["Mobile", "Android; Mobile"],
12@@ -94,4 +95,5 @@
13 "amazon.co.uk": ["Mobile", "Android; Mobile"],
14 "ebay.co.uk": ["Mobile", "Android; Mobile"],
15 "facebook.com": [/WebKit\/[.0-9]*/, "Apple$& Firefox/18"],
16+ "nytimes.com": ["Mobile", "Android; Mobile Safari"],
17 };

Subscribers

People subscribed via source and target branches

to status/vote changes: