Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Requests for comment/Mobile domain sunsetting/2025 Announcement

From mediawiki.org
<Requests for comment |Mobile domain sunsetting
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.

What is changing?

[edit]
Tracked inPhabricator
Task T214998
Before-and-after comparison.

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:

  • User experience: Links shared by mobile users always display in mobile mode instead of the mode for your device, even after opt-out.[1]
  • Site performance: Every Google Search result click is delayed by the redirect before displaying the article. See alsoT405429#11231816.
  • SEO: There is a conflict in our link graph because standard URLs redirect to mobile, and mobile sets a canonical pointer back to the standard URL. This de-indexes or mis-indexes pages in Google. See alsoT400022.
  • Infrastructure cost: MediaWiki sends twice as many purges to our CDN infrastructure.
  • Technical debt andknown issues (e.g. incompatibility with OAuth).

Over the next few weeks, the CDN will serve the mobile version directly, without first redirecting the browser to the mobile subdomain.

Timeline

[edit]

Planning:

Pilot rollout (T401595):

Main rollout (T403510), following a slowertrain-like rollout:

Clean up (T405931), redirecting the m-dot domains to the standard domain:

  • YesDone 22 Oct 2025: Redirecttest.m.wikipedia.org in all regions.
  • YesDone 23 Oct 2025: Redirect mobile domains in EU data center regions (Esams,Drmrs), including for countries in Europe and Africa.
  • YesDone 23 Oct 2025: Redirect mobile domains in all regions, including for countries in North America, South America, Asia, and Oceania.
  • To do To do Oct 2025: Blog posts ontechblog.wikimedia.org anddiff.wikimedia.org.

What is not changing

[edit]
  • Backend code may detect mobile mode viaMobileContext->shouldDisplayMobile().
  • Frontend JavaScript may detect mobile mode viamw.config.get('wgMFMode').[2]
  • Frontend stylesheets may target the Minerva skin via.skin-minerva.[2]
  • Third-party MediaWiki sites. This is a WMF configuration change only.
  • Mobile requests to MediaWiki (identical HTTP host and headers).
  • Existing mobile URLs continue to work.
  • The "Desktop" opt-out footer link.
  • The speed of light.

Backend requests unchanged

[edit]

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.

What should I test?

[edit]

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.

  • There is (probably) no mobile domain in your local dev environment.
  • There is no mobile domain in Patch demo.
  • There is no mobile domain in CI.

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.

Unsupported checks in frontend code

[edit]

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).

Example JavaScript

[edit]

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';}}

Example CSS

[edit]

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;}

Where can I test?

[edit]

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.

FAQ

[edit]

Will existing mobile URLs still work?

[edit]

Yes, existing mobile URLs (m. links) will continue to work regardless of the device you are using to access Wikimedia sites.

Can I still use the desktop view on my phone?

[edit]

Yes, you can continue to access the desktop view on a mobile device in a few different ways:

  1. Scroll to the bottom of the page and clicking the "Desktop" link. To get back to the mobile view, do the same thing but click the "Mobile view" link.
  2. If your mobile browser supports an option to "Request Desktop Site" or has a "Desktop site" toggle, it should change to the desktop view so long as the setting is enabled.

You do not need to be logged into a Wikimedia account to change these settings.

Can I still use the mobile view on my desktop/laptop?

[edit]

Yes, you can continue to access the mobile view on a desktop device in a few different ways:

  1. Scroll to the bottom of the page and clicking the "Mobile view" link. To get back to the desktop view, do the same thing but click the "Desktop" link. You do not need to be logged into a Wikimedia account to change these settings.
  2. If you are logged in to a Wikimedia account, you can set the mobile view as the default by going to Preferences > Appearance > Select the "MinervaNeue" option under "Skin" > Click "Save".

See also

[edit]

Footnotes

[edit]
  1. As of March 2025, the mobile domain sunsetting task is the most upvoted open task in Phabricator.https://phabricator.wikimedia.org/token/leaders/
  2. 2.02.12.2Remember that mobile detection should be rare in frontend code, because most differences are between skins (Minerva vs another skin) and not MobileFrontend itself. SeeT390923 for guidance.
Retrieved from "https://www.mediawiki.org/w/index.php?title=Requests_for_comment/Mobile_domain_sunsetting/2025_Announcement&oldid=7970647"

[8]ページ先頭

©2009-2025 Movatter.jp