MyBB Community Forums

Full Version: Why does Mybb automatically alter javascript ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Im using tawk.to on my website's home page (https://hovatek.com/) , Wordpress powered blog (https://blog.hovatek.com/) and mybb powered forum ( https://forum.hovatek.com/ ) . The srcipt works fine on the home page and blog but doesnt work on the forum

here's the original below
<script type="text/javascript">
var $_Tawk_API={},$_Tawk_LoadStart=new Date();

but mybb converts it to

<script type="text/javascript">
var ={},=new Date();

what is the cause and how can it be resolved?
Well, the magic of eval().. PHP thinks that your JS variable is in fact an empty PHP variable and prints it.
(2014-12-01, 10:46 PM)Destroy666 Wrote: [ -> ]Well, the magic of eval().. PHP thinks that your JS variable is in fact an empty PHP variable and prints it.

Yeah, php is seeing those $ as variables. will escaping them work?
Don't think there is an easy way to escape it in templates, you should rather put the JS code in a file and then load the file.