MyBB Community Forums

Full Version: Adding javascript in a thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I add some javascript in a post. Currently whenever I am adding some javascript code, its not getting executed.
You need enable HTML, but I don't recommend it. It can be insecure. You may be vulnerable to Cross Site Scripting hacks.
I have enabled HTML but still no luck. Only admins/super mods has permission to post in that forums.
oh? Hmm sorry. I thought you could with HTML enabled.. I'll test on my localhost and see.
MyBB strips out any Javascript for security reasons. You can remove it in inc/class_parser.php, but I highly recommend against it.
A safer alternative is to create a custom MyCode which will run the Javascript. However, this also means that normal users will also be able to use it.
DennisTT Wrote:MyBB strips out any Javascript for security reasons. You can remove it in inc/class_parser.php, but I highly recommend against it.
Thanks Dennis. As you said, I think I shouldn't go for editing the php files.



ZiNgA BuRgA Wrote:A safer alternative is to create a custom MyCode which will run the Javascript. However, this also means that normal users will also be able to use it.
I tried with custom MyCode also.. But myBB is replacing the <script tag with &gt;script. :-)
cgshelf Wrote:
ZiNgA BuRgA Wrote:A safer alternative is to create a custom MyCode which will run the Javascript. However, this also means that normal users will also be able to use it.
I tried with custom MyCode also.. But myBB is replacing the <script tag with &gt;script. :-)
The custom MyCode itself must have the <script> tag.

Post your custom MyCode regular expression and replacement.