Forum:Javascript for page content

An interesting comment has come up on one of the wikis that I'm participating on (see: c:runescape:Forum:Java calculators) and it got me thinking about the issues involving Javascript that could be added in some manner to page content.

First of all, what sort of legitimate security issues are there in regards to Javascript content in individual wiki pages that would make it so you wouldn't want to have it as HTML code within a normal editable page? Most HTML markups can be used (often isn't necessary, but it is available) when doing wiki mark-up. Javascript is one of the things that is explicitly removed from any wiki-editable page by ordinary users.

I know you can add/edit Javascript in the skin definitions, such as with MediaWiki:Common.js (a page found on nearly every Mediawiki wiki), but this is something that loads with each and every page. What I'm looking for is something that can load for a specific page only, such as a user page or in this case something like a pocket calculator. I'm even thinking here of something that could be used for demonstrating concepts of Javascript as a sort of tutorial.

The security issues are very legitimate here, I should add. I understand why Javascript shouldn't be opened up for any anonymous users randomly editing any wiki and throwing some Javascript that could potentially do some real damage. One of the approaches I'm thinking of here is some method (like an extension) that would link in an editable page that would contain the Javascript which is linked to the normal wiki page you want it linked to... sort of how talk pages are linked to a normal page. This would be something in a completely different namespace (for a variety of reasons) that could only be edited by administrators/sysops and perhaps a new user class called "Javascript editors" that are of similar trusted caliber.

Maybe I'm being too ambitious here, but it would be interesting to see some experimentation of a wiki community that had access to some of the rich content that could be developed with Javascript. Most of the current web browsers support Javascript (under whatever name they may be using... there are several names for nearly the same thing) in some fashion and it would be interesting to see what real issues might be a problem on a test wiki or two.

I'm bringing this issue up here both because I'd like to try this idea out with a wikia wiki (Wikia seems more open to this sort of experimentation) and there may be some solutions to doing something like this that I'm unaware of... or even an extension of MediaWiki that is already written to accommodate a request of this nature. I'm open to other ideas that aren't so drastic as having a whole namespace linked to content pages as well. The point is that I'd like to develop some Javascript applets that mix in with the already rich content found with wiki pages, and allow Javascript to be developed in a similar collaborative manner with multiple authors. --Robert Horning 14:41, 13 April 2009 (UTC)
 * You could make a template with a special class or id, and then write a script that identities that template's class or id and then preforms the desired function on the the page that the template is on; howver, I don't know much about JavaScript. --Michaeldsuarez (Talk) (Deeds) 14:52, 13 April 2009 (UTC)