Open main menu


Available from version master (Gerrit change 4377)
Take a URL and return a copy that conforms to the mobile URL template
Define function:
public static function onGetMobileUrl( string $url, bool $forceHttps=false ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"GetMobileUrl": "MyExtensionHooks::onGetMobileUrl"

For MediaWiki ≤1.25:

$wgHooks['GetMobileUrl'][] = 'MyExtensionHooks::onGetMobileUrl';
Called from:File(s): MobileFrontend extension/MobileContext.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:GetMobileUrl extensions.


  • $url : Contains the address.
  • $forceHttps : Predefined as false.