Extension:MobileFrontend

Installation

 * 1) Copy the files from the SVN repository to your server (see the "Download" links in the sidebox).
 * 2) Add this link to the bottom of LocalSettings.php:

Minified JS
Minified JS files are not included with the extension, and as such, need to be created for yourself (or stolen from elsewhere if possible).

There is a Makefile to minify these files using yuicompressor, but you also need Java runtimes installed. This can be done by running:

You can turn minified javascript off in  LocalSettings.php using $wgMFConfigProperties

Configuration settings
The following variables can be defined in LocalSettings.php after calling require_once("$IP/extensions/MobileFrontend/MobileFrontend.php"):

{| class="wikitable" ! Setting name ! Default value ! Description
 * $wgMFConfigProperties
 * Enable/disable beta mode
 * $wgMobileFrontendLogo
 * , defaults to $wgExtensionAssetsPath . '/MobileFrontend/stylesheets/images/mw.png'
 * Url to the logo used in the mobile view. Should be 22px tall at most.
 * $wgAppleTouchIcon
 * , means none
 * Url to the Apple touch icon
 * $wgMFMinifyJS
 * turns off minified javascript
 * Disable/enable minified javascript. When off the latest development off javascript will be used rather than the possibly more stable minified code.
 * $wgMobileUrlTemplate
 * $wgMFRemovableClasses
 * Make the classes, tags and ids stripped from page content configurable. Each item will be stripped from the page. The extension adds some classes by default.
 * $wgMobileRedirectFormAction
 * URL for script used to disable mobile site (protocol, host, optional port; path portion) e.g., http://en.wikipedia.org/w/mobileRedirect.php
 * $wgMFCustomLogos
 * Makes the logos configurable. Example:  Note that 'copyright' controls the image shown in the footer of the mobile page.
 * $wgMFExtendOpenSearchXml
 * Whether this extension should provide its excerpts to OpenSearchXml extension
 * $wgMobileFrontendFormatCookieExpiry
 * Make the classes, tags and ids stripped from page content configurable. Each item will be stripped from the page. The extension adds some classes by default.
 * $wgMobileRedirectFormAction
 * URL for script used to disable mobile site (protocol, host, optional port; path portion) e.g., http://en.wikipedia.org/w/mobileRedirect.php
 * $wgMFCustomLogos
 * Makes the logos configurable. Example:  Note that 'copyright' controls the image shown in the footer of the mobile page.
 * $wgMFExtendOpenSearchXml
 * Whether this extension should provide its excerpts to OpenSearchXml extension
 * $wgMobileFrontendFormatCookieExpiry
 * Makes the logos configurable. Example:  Note that 'copyright' controls the image shown in the footer of the mobile page.
 * $wgMFExtendOpenSearchXml
 * Whether this extension should provide its excerpts to OpenSearchXml extension
 * $wgMobileFrontendFormatCookieExpiry
 * Whether this extension should provide its excerpts to OpenSearchXml extension
 * $wgMobileFrontendFormatCookieExpiry
 * $wgMobileFrontendFormatCookieExpiry
 * $wgMobileFrontendFormatCookieExpiry

Extended action=parse
action=parse receives the following extra parameters:
 * mobileformat={html|wml}: Return rendered page in a mobile format, HTML for modern phones or WML for dumb phones.
 * noimages: Disable images in mobile output.
 * mainpage: Apply mobile main page transformations.

Example:

api.php?action=parse&page=Main_Page&mobileformat=html&prop=text&format=json

 {	"parse": { "title": "Main Page", "text": "\n<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n\n  This is a GeoData<\/a> test wiki. . . . 

action=mobileview
Delivers content optimized for mobile devices for use by mobile apps and dynamic section views. Almost like a restricted-functionality action=parse</tt>, but more flexible and separate sections HTML is always result of full page parse.

Parameters:
 * page</tt>: Title of page to process.
 * sections</tt>: Pipe-separated list of section numbers for which to return text.
 * redirect</tt>: Whether redirects should be followed, yes</tt> (default) or no</tt>. This parameter is intentionally made similar to the one to index.php.
 * prop</tt>: Which information to get:
 * text</tt>: HTML of selected section(s)
 * sections</tt>: Information about all sections on page
 * normalizedtitle</tt>: Normalized page title, will be returned only if it differs from the specified one.
 * sectionprop</tt>: What information about sections to get: pipe-separated list of value types defined by parser. It's the same as in action=parse: toclevel, level, line, number, index, fromtitle, anchor. "byteoffset" has been excluded as it makes no sense for this action.
 * noimages</tt>: Return HTML without images.

Returned section information also includes the id</tt> for every section - its zero-based number; and for sections that contains references added by Extension:Cite, there's also references</tt> data member.

Examples:


 * |sections&format=jsonfm api.php?action=mobileview&page=Example_page&sections=0&prop=text|sections&format=json

Same request for XML: |sections&format=xmlfm api.php?action=mobileview&page=Example_page&sections=0&prop=text|sections&format=xml

prop=extracts
Returns article extracts. Two formats are available: cleaned up HTML and plain text.

Parameters:
 * exchars</tt>: Length of extracts in characters.
 * exsentences</tt>: Number of sentences to return.
 * <tt>exintro</tt>: Return only zeroth section.
 * <tt>sectionformat</tt>: What section heading format to use for plaintext extracts:
 * <tt>wiki</tt> — e.g., == Wikitext ==
 * <tt>plain</tt> — no special decoration
 * <tt>raw</tt> — this extension's internal representation: <ASCII 1><ASCII 2> <ASCII 2><ASCII 1>.


 * <tt>exlimit</tt>: Maximum number of extracts to return. Because excerpts generation can be slow, the limit is capped at 20 for intro-only extracts and 1 for whole-page extracts.
 * <tt>explaintext</tt>: Return plain-text extracts.
 * <tt>excontinue</tt>: When more results are available, use this parameter to continue.

Example:

api.php?action=query&prop=extracts&exchars=100&titles=Earth&format=json

WMF properties
On Wikimedia Foundation run properties, we use Varnish caching servers to check the user agent of your device. If your user agent appears to be coming from a mobile device, the Varnish servers will set an appropriate 'X-Device' header for your request, and you will be redirected to the MobileFrontend version of an article. Alternatively, you can click 'Mobile view' in the footer of an article or append "useformat=mobile" to the query string to view an article in the mobile view.

If you are viewing the mobile version of article but wish to see the desktop-version of that article, you can click 'View this article on regular <SITENAME>' to switch back.

If you want to permanently disable the mobile view for your web browser, you can click 'Permanently disable mobile site', which will set a cookie instructing the WMF servers to always display the desktop version of the site.

Non-WMF properties
For non-WMF properties, you can either set up your configuration to mimic how things are done at the WMF (doing device detection at the proxy layer and setting specific X-Device headers), or you can simply use "?useformat=mobile" to switch an article to use the mobile view.

Note: clicking 'Permanently disable mobile site' on non-WMF properties will result in a 404 page not found error. This is a known issue and a fix is forthcoming. See 35205.

WMF cluster deployments
See Extension:MobileFrontend/Deployments for deployment information on past and upcoming deployments of MobileFrontend to the WMF cluster.