Will Jones
Will Jones

Reputation: 65

Turning off the async attribute in MediaWiki resource loader script tag

I have a dependency, and I think the asynchronous loading of MediaWiki resources (jQuery specifically) is causing a problem. Is there a way to switch off this attribute in a MediaWiki setting?enter image description here

Upvotes: 0

Views: 73

Answers (1)

Will Jones
Will Jones

Reputation: 65

I solved this by copying the structure of a jQuery dependency in resources/Resources.php with the resource I wanted to include and uploaded the .js file to the specified folder.

Then added the following code to LocalSettings.php:

$wgHooks['BeforePageDisplay'][] = function( OutputPage &$out, Skin &$skin ) {
  $out->addModules('mymodule');
  return true;
};

Upvotes: 1

Related Questions