// Set the fragment if one was specified in the redirect
if ( strval( $this->getTitle()->getFragment() ) != '' ) {
- $outputPage->addInlineScript( Xml::encodeJsCall(
- 'redirectToFragment', array( $this->getTitle()->getFragmentForURL() )
- ) );
+ $outputPage->addJsConfigVars( 'wgRedirectToFragment', $this->getTitle()->getFragmentForURL() );
+ $outputPage->addModules( 'mediawiki.action.view.redirectToFragment' );
}
// Add a <link rel="canonical"> tag