This page is a translated version of the page Extension:MobileFrontend and the translation is 41% complete.
Outdated translations are marked like this.
Other languages:
Deutsch • ‎English • ‎Tiếng Việt • ‎Türkçe • ‎español • ‎français • ‎polski • ‎português • ‎português do Brasil • ‎svenska • ‎русский • ‎中文 • ‎日本語 • ‎한국어


  • 为您的移动端流量创建一个单独的移动网站。
  • 为使你的内容更友好,提供各种内容转换
    • 容易注意的小节收起和内容重排和删除。
  • 简化移动端页尾并添加一个桌面/移动版网站链接

Special:History, Special:Contributions, Special:Watchlist, Special:Preferences, Special:MobileDiff

  • 提供特殊页面 Special:Nearby, Special:MobileOptions (用于移动端皮肤偏好设置), Special:MobileLanguages (用于语言选择)。
  • 提供beta模式,其包含一个功能管理系统,用于为匿名用户添加实验性功能

OOjs UI icon advanced.svg
发布状态: 稳定版
MediaWiki-Vagrant MobileFrontend Extension.png
实现 用户界面, 钩子
描述 提供对移动端友好的视图
最新版本 2.3.0
兼容性方针 发行分支
MediaWiki 1.33+[1]
PHP 5.5.9+
许可协议 GNU通用公眾授權條款2.0或更新版本
例子 m.mediawiki.org
  • $wgMFSearchGenerator
  • $wgMFStopRedirectCookieHost
  • $wgMFShowMobileViewToTablets
  • $wgMFStripResponsiveImages
  • $wgMFLazyLoadImages
  • $wgMFRSSFeedLink
  • $wgMFNamespacesWithLeadParagraphs
  • $wgMFAmcOutreachMinEditCount
  • $wgMFEnableMobilePreferences
  • $wgMFMobileFormatterOptions
  • $wgMFRemovableClasses
  • $wgMFContentProviderTryLocalContentFirst
  • $wgMFShowFirstParagraphBeforeInfobox
  • $wgMFMinCachedPageSize
  • $wgMFContentProviderClass
  • $wgMFVaryOnUA
  • $wgMFLogWrappedInfoboxes
  • $wgMFDisplayWikibaseDescriptions
  • $wgMFAlwaysUseContentProvider
  • $wgMFSchemaEditAttemptStepOversample
  • $wgMFDefaultSkinClass
  • $wgMFEnableJSConsoleRecruitment
  • $wgMobileFrontendFormatCookieExpiry
  • $wgMFAmcOutreach
  • $wgMFResponsiveImageWhitelist
  • $wgMFLazyLoadSkipSmallImages
  • $wgMFSearchAPIParams
  • $wgMFContentProviderScriptPath
  • $wgMFAdvancedMobileContributions
  • $wgMFEnableXAnalyticsLogging
  • $wgMFUseDesktopSpecialHistoryPage
  • $wgMFWatchlistEditCountThreshold
  • $wgMFSiteStylesRenderBlocking
  • $wgMFMcsContentProviderBaseUri
  • $wgMFUseWikibase
  • $wgMobileUrlTemplate
  • $wgMFCollapseSectionsByDefault
  • $wgMFManifestBackgroundColor
  • $wgMFEnableFontChanger
  • $wgMFManifestThemeColor
  • $wgMFEnableManifest
  • $wgMFSchemaSearchSampleRate
  • $wgMFNoMobileCategory
  • $wgMFNearby
  • $wgMFEnableWikidataDescriptions
  • $wgMFNamespacesWithoutCollapsibleSections
  • $wgMFSpecialPageTaglines
  • $wgMFNearbyRange
  • $wgMFEnableBeta
  • $wgMFBetaFeedbackLink
  • $wgMFDefaultEditor
  • $wgMFNoindexPages
  • $wgMFAutodetectMobileView
  • $wgMFUseDesktopSpecialWatchlistPage
  • $wgMFQueryPropModules
  • $wgMFNoMobilePages
  • $wgMFMwApiContentProviderBaseUri
  • $wgMFMobileHeader
  • $wgMFMobileFormatterNamespaceBlacklist
  • $wgMFSpecialCaseMainPage
问题 开放的工作 · 报告错误



Before installing MobileFrontend, if you make heavy use of templates and/or inline styles (the style attribute) you should review your content to see whether it is mobile friendly. The TemplateStyles extension can be used to style content so that it renders nicely on mobile and desktop. MobileFrontend will not magically fix this for you!

In particular, you may want to review your landing page (main page). 請參閱移動首頁格式


  • 如果使用Vagrant ,请通过vagrant roles enable mobilefrontend --provision安装
  • 下载文件,并将其放置在您extensions/文件夹中的MobileFrontend目录内。


MobileFrontend provides the Special:Nearby page with a little configuration. To get this to work a few optional steps are required:

  1. Due to browser security you will need to be running a secure site over SSL — it is not possible to request a user's location over HTTP.
  2. Install the GeoData extension
  3. Run update.php
  4. In LocalSettings.php add $wgMFNearby = true;
  5. Determine article coordinates:
    1. Add location data to your articles by using the coordinates parser function, for example {{#coordinates:37.786971|-122.399677|primary}}. For syntax details, see the documentation for GeoData .
    2. Alternatively you can use a separate MediaWiki installation for Nearby by setting $wgMFNearbyEndpoint in your LocalSettings.php file. For example, $wgMFNearbyEndpoint = 'https://en.m.wikipedia.org/w/api.php'; will use coordinates of English Wikipedia articles. The nearby endpoint will be used to find content related to a given location.


MobileFrontend provides you with a mobile formatted website to go alongside your existing desktop website. You can skin it however you want.

 // Choose one of these and add chosen code to bottom of LocalSettings.php file:
 wfLoadSkin( 'MinervaNeue' );
 $wgMFDefaultSkinClass = 'SkinMinerva'; // use Minerva skin (You need to download and install it separately, otherwise you'll get an exception)
 wfLoadSkin( 'Vector' );
 $wgMFDefaultSkinClass = 'SkinVector'; // use Vector skin
 wfLoadSkin( 'Timeless' );
 $wgMFDefaultSkinClass = 'SkinTimeless'; // use Timeless skin

The following skins are compatible with MobileFrontend:




Get the most out of MobileFrontend by adding these optional compatible extensions:


CSS 样式

To apply CSS to your mobile theme, edit MediaWiki:Mobile.css, the counterpart of MediaWiki:Common.css.

MobileFrontend does not load the global MediaWiki:Common.css, neither does it load any of the user stylesheets.


If you would like to test the mobile extension on a desktop browser or your device doesn't render the mobile version, you can append the following key-value pair to the URL query string: ?useformat=mobile. For example: https://en.wikipedia.org/wiki/Chuck_Schuldiner?useformat=mobile

If you would like to view the mobile version of a page without enabling the extension across the entire site you can append the string too the url on that page, too.


MobileFrontend has traditionally been a very large extension. Many features have either surpassed their requirements or will do at some future date. These are listed below.


APIs are provided by the MobileFrontend extension, but long term we expect to deprecate them in favour of Mobile Content Service. Use these APIs at your own risk. They may disappear (although we will give you sufficient notice when they do)!

MobileView API

See Extension:MobileFrontend/MobileViewAPI .

扩充 action=parse

action=parse accepts extra parameters:

Return rendered page HTML in a mobile format 1.23+. Prior to MediaWiki 1.23, you could specify mobileformat=html to output HTML for modern phones or mobileformat=wml to output WML for dumb phones (see mailing list messagefor details).
Disable images in mobile output.
Apply mobile main page transformations.



The domain of the mobile version of the site (which might or might not be the same as the normal domain) is available under the mobileserver key of the general siteinfo information.



您可能需要运行npm install并安装composer来运行预调试挂钩,这取决于您对扩展的配置。


MobileFrontend can now be configured locally to render articles from other MediaWiki instances.[2] This can help you debug problems locally instead of importing articles which may have dependencies on various templates and Wikibase identifiers from production to your local instance. This is not recommended for production usage.

The code below will turn your local MediaWiki mobile site into a Wikivoyage viewer:

$wgMFContentProviderClass = 'MobileFrontend\ContentProviders\MwApiContentProvider';
$wgMFMwApiContentProviderBaseUri = 'https://en.m.wikivoyage.org/w/api.php';

This is particularly useful for testing different mobile skins using the wgMFDefaultSkinClass config option.



On Wikimedia Foundation-run sites, we use Varnish caching servers to check the user agent of your device.


For non-WMF sites, 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.

Starting from the snapshot version 1.28, the default $wgMFMobileHeader was changed from X-WAP to X-Subdomain. You could either set $wgMFMobileHeader = 'X-WAP'; or modify your cache (Varnish) header setting. As long as they match.


The following questions frequently appear on our talk page. Please check this list before posting about them on the talk page or use the existing talk topic, if available, to receive clarifications.

Q: How do I customise the main menu of the Minerva skin?

A: This is tracked in phabricator but you can see Topic:Tiggc18fvd3stmsf has an interim solution.

Q: How do I add HTML to the Minerva skin, for example to add ads or additional script tags?

A: You can do this by editing the template file for the skin (currently include/skins/minerva.mustache). See this discussion for details.

Q: The extension I am using doesn't seem to work on MobileFrontend. Why?

A: It's likely the extension is old and needs to add compatibility to MobileFrontend. Please contact the developer of the extension and point them to ResourceLoader/Writing a MobileFrontend friendly ResourceLoader module. Please do not post to the talk page, as in this case it would be better to file a bug on Phabricator (you can login using your MediaWiki.org username) for a quicker response.

Q: I upgraded MobileFrontend and now I'm getting a fatal exception!

A: You are probably using incompatible versions of MobileFrontend and MediaWiki. In most cases, we can't help you here. Try upgrading MobileFrontend or MediaWiki to resolve your issue.

Q: After upgrading MediaWiki I'm getting an exception wgMFDefaultSkinClass is not setup correctly.

A: MobileFrontend currently assumes you have the 皮肤:Minerva Neue skin installed. If you don't you'll need to install this or configure your mobile skin per instructions above.






  1. :Fatal error: Uncaught ExtensionDependencyError: MobileFrontend is not compatible with the current MediaWiki core (version 1.32.2), it requires: >= 1.33.0.
  2. See this YouTube demo video