Forum:Custom javascript on pages

Im trying to include custom javascript code in certain pages on the wiki. I have already put the .js files in the MediaWiki namespace, but I don't know how to reference them in regular pages as the system sanitizes regular tags. Please help.

Edgerunner 13:23, November 21, 2011 (UTC)


 * tags are stripped because if they weren't, vandals and spambots could attack your wiki with malicious code. You can use MediaWiki's,   and   functions to include other scripts in your   file. For example, if you wanted   on the page Bar, you could put   in.


 * I was hoping for something that I could specify in the page itself but I guess this will have to do. Maybe I could check the page for a certain element with an ID or class. Thanks. — Edgerunner 13:53, November 21, 2011 (UTC)
 * BTW, Where can I find documentation for the functions you mentioned? — Edgerunner 14:06, November 21, 2011 (UTC)


 * Documentation should be somewhere on mediawiki.org, although I don't know where you'd find it there.  and   take one parameter, always a string;   accepts the name of a page to pull the script from (on the same wiki - so on central, it'll pull the page from central, but on Call of Duty wiki, it'll pull the page from Call of Duty), whereas   accepts a url and simply plugs it into the   of a   tag (and won't load the same url twice).   was added by Wikia, and accepts two strings, the first being a page name and the second being the domain of the wiki to load from (for example,   will load foo.js from Community Central).

Now I found out that MediaWiki 1.16 (Wikia's) has a bug that makes it lose the  attributes on tags, and that MediaWiki 1.17 fixes that, any ideas on when Wikia will upgrade? Edgerunner 14:12, November 24, 2011 (UTC)