flyingfox
flyingfox

Reputation: 13506

How to add an onload script for MediaWiki

I installed a and my version is 1.21.1, now I want to add some code when the page is onload using . I have searched on the Internet and found we can put our scripts on the Common.js file, but I don't found Common.js in my wiki project. I have searched the whole directory and still did not find it.

Anyone could tell me how to achieve my goal?

Upvotes: 0

Views: 567

Answers (1)

Nemo
Nemo

Reputation: 2544

brightbyte's answer, which worked: Enter MediaWiki:Common.js into the search box of your wiki. It will tell you the page doesn't exist - just create it. Any JS code you put in there will be executed on every page load. Of course, you have to be an administrator to create or edit that page.

This is documented at Manual:Interface/JavaScript; there are similar customisations at Manual:User group CSS and Javascript and Manual:Page customizations.

Upvotes: 1

Related Questions