Putting javascript into a post
-
I know its possible to put html & javascript in a widget and have that run, but is there a way to do that in a post?
One example of where I might want to do that is; I created a mini-quiz on classmarker, who give embed links
Can I put that in a post?
The format of the embed link is below<script src="https://www.classmarker.com/public/js/embed-classmarker-1.0.0.js?quiz=... </script>
-
@eeeee this isn't possible without altering the markdown settings - more specifically, HTML Sanitization.
Automatic HTML sanitization is an important part of ensuring that your users do not run arbitrary javascript or alter parts of the page that were not meant to be altered.
This used to be the sole line of defense from rogue HTML in user-generated content. However, NodeBB now comes with its own built-in HTML sanitizer so it is safe to disable this one if necessary
Enabling this option will expose your forum to risk in the sense that arbitrary code can then be executed which isn't something I'd recommend. Widgets allow this functionality because they do not accept input from users whereas posts obviously do.