Adding a javascript in a post?

You may need a plugin or at least a Theme Component.

JavaScript is not allowed in posts - can you imagine the potential mischief of allowing randoms to post javascript?

JavaScript is allowed in Theme Components (which are under the admin’s control) but that may not solve the whole problem.

Finally, because Discourse is built within the Ember framework, the exact order of despatch makes using random additional javascript scripts a little less predictable (hence why you may need a Theme Component or Plugin to integrate the code in the right way).

To post code you use three back ticks before and after. `

FYI Amazon affiliate links work. The javascript element is placed in a Theme Component and the link is placed in the post.

4 Likes