Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 4 Years, 3 Months ago [JavaScript] Why does Mybb automatically alter javascript ?
#1
Solved: 4 Years, 3 Months ago
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?
Hovatek Forum | Hovatek Journal | Hovatek Blog | H-Tech Radio

Hovatek....just a button away!



Reply
#2
Solved: 4 Years, 3 Months ago
Well, the magic of eval().. PHP thinks that your JS variable is in fact an empty PHP variable and prints it.
Reply
#3
Solved: 4 Years, 3 Months ago
(12-01-2014, 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?
Hovatek Forum | Hovatek Journal | Hovatek Blog | H-Tech Radio

Hovatek....just a button away!



Reply
#4
Solved: 4 Years, 3 Months ago
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)