Page MenuHomePhabricator

mobile version replaced by desktop version in a webview on iPad apps
Closed, ResolvedPublic

Description

Author: blanc.greg

Description:
in many iPad apps :
an ios webview loading the mobile url http://en.m.wikipedia.org/wiki/Paris will not load the mobile version but the desktop version.

this is also the case for all mobile url I could test. This is very annoying as many ipad apps are loading the mobile url in a webview which is not fullscreen, and so the wiki is not easily readable.

thanks for your help !


Version: --
Severity: critical
OS: other
Platform: Other

Details

Reference
bz31012

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:53 PM
bzimport set Reference to bz31012.
bzimport added a subscriber: Unknown Object (MLST).

Can you confirm that it's directly loading http://en.m.wikipedia.org/wiki/Paris -- and *not* loading http://en.wikipedia.org/wiki/Paris and then expecting an automated redirect?

Can you recommend any particular apps to try to help reproduce the problem for testing?

blanc.greg wrote:

Hi Brion,

I confirm the UIWebView is really loading http://en.m.wikipedia.org/wiki/Paris and is NOT expecting an automated redirect.

This happens on iPad for example with this free app (but not on iPhone)
http://itunes.apple.com/fr/app/world-explorer/id381581095?mt=8
here's a promo code to download it : FE9T7YXJ7M7F
Procedure to use the code:
+ Open the appstore on the iPad
+ click on "Selection"
+ go to the bottom of the page
+ click on "Redeem code"
+ enter the code
+ the app is downloaded for free.

This also happens on this Free Mac app :
http://itunes.apple.com/us/app/world-explorer/id414872849?mt=12

thanks for your help !

regards

blanc.greg wrote:

*** Bug 31013 has been marked as a duplicate of this bug. ***

blanc.greg wrote:

the following code is from the mac app mentioned above. It shows that the app really loads the mobile url :

NSString *wikURL = [NSString stringWithFormat:@"http://en.m.wikipedia.org/wiki/%@",wikTitle ];

[webView setMainFrameURL:wikURL];

We can indeed confirm this on the iPad and Mac versions, much to our surprise. :)

The request is going to en.m.wikipedia.org but somehow is getting back the desktop view -- the HTTP request headers are:

GET /wiki/Eiffel%20Tower HTTP/1.1
Host: en.m.wikipedia.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

Aha, we think it's the use of spaces in the title -- the canonical hit should be to /wiki/Eiffel_Tower (with underscore). It looks like MediaWiki's coming back with the canonical-form redirect before the MobileFrontend system has a chance to override the output -- and since it directs to the non-mobile URL, you no longer get the mobile view.

We'll see if we can workaround...

I added a hook in r97573 (on trunk - to be merged) which Patrick should be able to use to abort or alter the redirect when on the special mobile domain. Might want/need more generalization in the future, but the code in MediaWiki::performRequest is just not well factored right now. :)

Merged to REL1_18 and 1.17wmf1.

preilly wrote:

Fix added in r97645 to Mobile Frontend extension to abort redirect on special mobile domain.