Last modified: 2014-02-12 23:45:33 UTC
Copying request from the mediawiki-api list. Tried to get the reporter to report this themselves, but apparently the restrictions put in place after the spam attack prevented that. http://lists.wikimedia.org/pipermail/mediawiki-api/2011-November/002431.html ================================ Hi All, Will the useformat=mobile be supported by MediaWiki API where appropriate? I am able to do the following for non mobile content $.getJSON('http://en.wikipedia.org/w/api.php?action=parse&page='+encodeURIComponent(query)+'&prop=text&format=json&callback=?', function(json) { // do stuff }); It would be nice if adding the parameter useformat=mobile would get the json object of the mobile page content like http://en.wikipedia.org/wiki/Main_Page?useformat=mobile&format=json but this link returns a file containing a json object of the page content Regards, Asher Szmulewicz
This feature is supported since Dec 16th 2011 thanks to Patrick Reilly who added JSONP/callback support It is working very well in all browsers except IE9 (yes it works in IE7 and 8) The problem is a security problem see http://stackoverflow.com/questions/5986772/ie9-script-response-blocked-due-to-mime-type-mismatch the solution of the problem from the msdn guys The problem is an X-Content-Type-Options: nosniff declaration and returning a JavaScript file without a JavaScript MIME type. This can only be fixed by either removing the nosniff declaration or by fixing the MIME type to indicate that the file is, in fact, script. Can you please fix this Thanks Asher Szmulewicz
Probably better if done through the API ?
You may be right since the API works in IE9 In the meantime if the response header is changed from Content-Type:application/json (this is its value today) to Content-Type:text/javascript it will work also for IE9 w/o changing the X-Content-Type-Options: nosniff
Extension:MobileFrontend could provide an API to something like api.php?action=query&list=mobilecontent
(In reply to comment #4) > Extension:MobileFrontend could provide an API to something like > api.php?action=query&list=mobilecontent I thought adding the parameter useFormat=mobile (to be consistent with extension:mobileFrontend) whenever possible in the api. I am using the following $.getJSON('http://en.wikipedia.org/w/api.php?action=parse&page='+encodeURIComponent(query)+'&prop=text&format=json&callback=?', function(json) { // do stuff }); It would become $.getJSON('http://en.wikipedia.org/w/api.php?action=parse&page='+encodeURIComponent(query)+'&prop=text&format=json&useFormat=mobile&callback=?', function(json) { // do stuff });
I'm currently working on this. It looks the following way: api.php?action=parse&page=foo&mobileformat=wml As it's part of the normal API, all usual formats are supported, unlike the current hack.
Implemented in trunk.