This page in a nutshell: Mobile devices will receive the mobile version directly on the standard domain, instead of via a redirect to the mobile subdomain. The change is live in the Beta Cluster and on test wikis, and expected to follow a train-like rollout over the next few weeks. |

Today, when you visit a link to a wiki (like en.wikipedia.org), the server responds in one of two ways: a desktop page, or a redirect to the equivalent mobile URL (like en.m.wikipedia.org). This mobile URL in turn serves the mobile version of the page from MediaWiki. Our CDN operates this way since 2011, when we enabled MobileFrontend by default.
This redirectcauses a number of problems, such as:
Over the next few weeks, the CDN will serve the mobile version directly, without first redirecting the browser to the mobile subdomain.
Planning:
Pilot rollout (T401595):
Main rollout (T403510), following a slowertrain-like rollout:
Clean up (T405931), redirecting the m-dot domains to the standard domain:
MobileContext->shouldDisplayMobile().mw.config.get('wgMFMode').[2].skin-minerva.[2]The mobile subdomain on WMF wikis is only recognised by Varnish (Wikimedia CDN). Varnish strips this "m" from the domain, activates MobileFrontend, and forwards the request to MediaWiki with the standard domain.
This means MediaWiki core and extensions know how to handle mobile requests on the standard domain, because that's how it already works. It also means that the change is not observable (through supported means) by backend feature code in MediaWiki, because the mobile subdomains don't exist there.
If your gadget or MediaWiki extension does not vary its behavior for mobile, or detects mobile mode using the supported mechanism listed above, then you're all set.
Note that Minerva-specific or mobile-specific code in a MediaWiki extension is naturally compatible with unified mobile routing, if it was tested locally or in CI. When you install Minerva (and optionally MobileFrontend) in your dev environment, they operate without a mobile subdomain by default.
This infrastructure change aligns WMF production with how MediaWiki and MobileFrontend work by default. This decreases the potential for bugs we have today that can be exclusively found in production (via the mobile subdomain), and resolves a backlog of existingknown issues.
If a JavaScript-based feature contains a hardcodedm. hostname check, then this will no longer match in the future. The most likely place to find hardcodedm. checks is in a gadget or user script that changes its appearance or logic for mobile pages.
Detecting the mobile mode in this way is unsupported and should be replaced with asupported mechanism instead.[2] An audit in April 2025 found there were 2 WMF-deployed extensions using this, which were confirmed to fallback gracefully or have since been adjusted (T390923).
These are examples of JavaScript code ingadgets and user scripts. Most of these are fine and need no changes, because they are about the URL or domain itself.
Check the hostname to create a link to the same domain as you are on (fromHotCat V2.44 ). This is OK.
varorigin=location.host.includes('.m.')?'//'+location.host:mw.config.get('wgServer');load(origin+conf.wgScript+'?title='+encodeURIComponent(page));
Check the hostname to authorize or avoid a cross-domain request (fromGadget-GoogleTrans.js). This is OK.
if(location.host.indexOf('.m.')===-1){document.domain=mw.config.get('wgServerName');}
Create a link for mobile users to an article on the mobile domain (fromcommonswiki Mobile.js,rowiki Mobile.js,dewiktionary Mobile.js). This is OK.
varhtml='<a href="https://commons.m.wikimedia.org/wiki/Commons:Mobile_app">help</a>';mw.util.addPortletLink("p-interaction","https://ro.m.wikipedia.org/wiki/Ajutor:Bun_venit","Welcome");
Automatically redirect to the standard domain even if you visit the mobile domain via someone else's link (fromvariousscriptsacrosstheecosystemandbeyond) This is OK, and is a common workaround for the "Desktop" opt-out link not remembering your choice. This is not needed in the future, but causes no problem.
// From https://webapps.stackexchange.com/a/106139// Find the link used to switch to the desktop view.vardesktopLink=document.getElementById("mw-mf-display-toggle");if(desktopLink&&!desktopLink.href.includes('.m.')){window.location.replace(desktopLink.href);}
if(location.href.search("m.wikipedia")!==-1){location.href=location.href.replace("m.wikipedia","wikipedia");}
JavaScript code that responds to page content changes by MobileFrontend,should not use URL detection. It is rare for MobileFrontend to change page content. If you currently check the URL to detect this, then youshould change to checkwgMFMode instead. For example, a gadget might integrate with the MobileFrontend discussion page format (e.g.Convenient Discussions andXFDcloser):
- var isMobileSite = location.host.includes(".m.") || location.search.includes("useformat=mobile");+ var isMobileSite = !!mw.config.get("wgMFMode");
// Good: Detect MobileFrontend, which renders discussion page differentlyvarisMobileSite=mw.config.get("wgMFMode");$("#mw-content-text h3").each(function(){varview=DiscussionView.newFromHeadline(this);if(isMobileSite){$(this).parent().next().prepend(view.$element);}else{$(this).after(view.$element);}});
Another example is JavaScript is used to create something new that does not depend on MobileFrontend, but where you prefer to change the styling when the gadget is used on mobile. This shouldnot use URL detection. If you are trying to make something look better for the Minerva skin, use CSS instead (see#Example CSS). If you are trying to remove content not needed on mobile, then checkwgMFMode instead (example fromruwikinews gadget):
- if (location.host.includes('ru.m')) {+ if (mw.config.get('wgMFMode')) {
// Good: Detect MobileFrontendif(mw.config.get('wgMFMode')){varback=document.getElementById('background');if(back){document.getElementById('background').style.display='none';}}
These are examples of CSS code ingadgets and user scripts. Most of these are fine and need no changes.
Custom styles applied to desktop and mobile. This is OK.
code{box-shadow:1px1px3pxcurrentcolor;}
Custom style applied to the Minerva skin, which is used on mobile. This is OK.
.skin-minervacode{box-shadow:1px1px3pxcurrentcolor;}
Mozilla syntax (Firefox, Greasemonkey, Stylus, etc) applied to both desktop and mobile. This is OK:
@-moz-documentdomain("fr.wikipedia.org"),domain("fr.m.wikipedia.org"){code{box-shadow:1px1px3pxcurrentcolor;}}
Mozilla syntax applied to a standard domain. This is OK:
@-moz-documentdomain("wikipedia.org"){.skin-minervacode{box-shadow:1px1px3pxcurrentcolor;}}
Mozilla syntax limited to the mobile domain. Thisshould change to target the standard domain instead.
/* Bad */@-moz-documentdomain("m.wikipedia.org"){code{box-shadow:1px1px3pxcurrentcolor;}}
If the style should be limited to mobile, then add the.skin-minerva selector to limit the style to the Minerva skin:
- @-moz-document domain("m.wikipedia.org") {+ @-moz-document domain("wikipedia.org") {- code {+ .skin-minerva code {
/* Good */@-moz-documentdomain("wikipedia.org"){.skin-minervacode{box-shadow:1px1px3pxcurrentcolor;}}
JavaScript import limited to the mobile domain (example). Thisshould change to remove the condition, and instead use the.skin-minerva selector to limit the style to the Minerva skin used on mobile.
/* Bad: [[User:Example/common.js]] */if(location.host==="ru.m.wikipedia.org"){importStylesheet('User:Example/mymobile.css');}/* Bad: [[User:Example/mymobile.css]] */.navbox{display:block!important;}
/* Good: [[User:Example/common.css]] */.skin-minerva.navbox{display:block!important;}
The new unified mobile routing is live on these wikis:
For other production wikis, such as en.wikipedia.org, you can preview the change today by adding?useformat=mobile to a URL. This activates MobileFrontend on the standard domain, like it would in the future. For example:https://en.wikipedia.org/wiki/Banana?useformat=mobile.
Thetimeline spans several weeks and should not require dedicated testing. If you're unsure, you can test on the pilot wikis above, or in production via theuseformat=mobile parameter. If you find a bug with mobile toggling or another regression, pleasereport a bug to Phabricator. If you have questions or need help with a gadget or user script, please reach out on thetalk page.
Yes, existing mobile URLs (m. links) will continue to work regardless of the device you are using to access Wikimedia sites.
Yes, you can continue to access the desktop view on a mobile device in a few different ways:
You do not need to be logged into a Wikimedia account to change these settings.
Yes, you can continue to access the mobile view on a desktop device in a few different ways: