Topic on Project:Support desk

Include javascript file on every page

3
2620:15C:281:FD0F:6491:1019:3193:855E (talkcontribs)

I have a file, "all.js", that I want to include in every page. I'm wondering:

1. Where is the best place to do this?

2. How do I make sure that the mediawiki object (mw) is available?

Cheers!

87.123.43.195 (talkcontribs)

It depends:

  • If your file depends on other things, e.g. on jQuery, then you should integrate it using a ResourceLoader module. This should especially be done, if the file is used inside a skin or an extension. It might then be possible to use a hook to integrate the file.
  • If the file does not depend on anything, then you can just put its contents into one of the CSS pages. See Manual:Interface/Stylesheets for more information!
Ciencia Al Poder (talkcontribs)
Reply to "Include javascript file on every page"