1. Home
  2. Programming Tools
  3. How to Add new CSS or JavaScript code in MediaWiki?

How to Add new CSS or JavaScript code in MediaWiki?

If you ever want to add a new CSS or JavaScript code in MediaWiki, then here’s how you can do that. MediaWiki comes with two pages – MediaWiki:Common.css and MediaWiki:Common.js, where you can add your own CSS or JavaScript codes. But remember, the changes in MediaWiki:Common.css and MediaWiki:Common.js pages will affect all the skins and in case if you make any error, it will disrupt all the pages.

add new css js file

To add CSS code, browse to MediaWiki:Common.css as shown below:

http://<mediawiki-url>/MediaWiki:Common.css

To add JS code, browse to MediaWiki:Common.js page as shown below:

http://<mediawiki-url>/MediaWiki:Common.js

Note: Some MediaWiki sites may have index.php in the URL, in that case, the URL goes like this.

http://<mediawiki-url>/index.php/MediaWiki:Common.css

Once the page is saved, the changes will reflect immediately, else you have to bypass browser cache by holding CTRL key + Reload (In Internet Explorer) and Shift+CTRL+Reload in Mozilla browsers.

Updated on September 1, 2017

Was this article helpful?

Related Articles

Leave a Comment