JavaScript-Editable

Summary: How to include JavaScript markup in wiki pages
Version: 20190619
Prerequisites:
Status:
Maintainer:
Categories: Markup
Users: +1 (View / Edit)

Question

Is it possible to include JavaScript markup in wiki pages?

Answer

Yes. Using this recipe you can embed JavaScript in your pages. However, keep in mind that allowing JavaScript (as well as html) on an editable wiki page is dangerous: code inserted by a malicious visitor could be quite harmful. In this case, password protecting the pages is a reasonable suggestion.

Put in your cookbook directory this file: JavaScript-Editable.phpΔ

then add this to your config.php file:

 include_once('cookbook/JavaScript-Editable.php');

This recipe won't parse the text within (:html:) and (:htmlend:).

Example in your wiki page:

   (:html:)
   <script language="JavaScript">
       alert("Thanks to PM for that markup.");
   </script>
   (:htmlend:)

Notes

It must be stressed again and again that including JavaScript on an editable page could be dangerous.

See Also

Contributors

  • Luigi -> mailto:kirpi [snail] kirpi [period] it humbly reported from the Mailing Lists.
  • Torsten is the main contributor.

Comments

See discussion at JavaScript-Editable-Talk

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.