MyBB Community Forums

Full Version: External Javascript not Appears!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

Yesterday, I've added a javascript code , But it doesn't appears. ( Added in Header template )

NOTICE: All other live chat was working , but this one isn't .

Okey , So I created a .php file and added the javascript code to it , and it appears Sad

So why on MyBB it can't appear. please help Sad

Forum link: free.vekoltc.eu.org
Link where it appears: free.vekoltc.eu.org/livechat/index.php

Code in header template of used theme:
<!--Start of Tawk.to Script-->

<script type="text/javascript">
var $_Tawk_API={},$_Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/54b40780f7d9f97ff802c1b0/default';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>
<!--End of Tawk.to Script-->

NOTICE: Even in index template not appears.

Thanks please help me Sad

BUMP~ Help please Sad((

Pleaaase....
we cannot use php variables directly in MyBB. you can experiment it with PHP in Templates plugin
(2015-01-13, 09:32 AM).m. Wrote: [ -> ]we cannot use php variables directly in MyBB. you can experiment it with PHP in Templates plugin

Still not works, I can't use this plugin.
hmm., please see this reply
(2015-01-13, 10:57 AM).m. Wrote: [ -> ]hmm., please see this reply

you should rather put the JS code in a file and then load the file.

How this ?
^ you can add the content without first line and last line to a js file (eg. tawk.js)
i.e. remove <script type="text/javascript"> and </script>
and add it to the forum template with regular javascript loading code like below

<script type="text/javascript" src="path/to/tawk.js"></script>
(2015-01-13, 11:07 AM).m. Wrote: [ -> ]^ you can add the content without first line and last line to a js file (eg. tawk.js)
i.e. remove <script type="text/javascript"> and </script>
and add it to the forum template with regular javascript loading code like below



<script type="text/javascript" src="path/to/tawk.js"></script>

Was this simple like thaT? OMG

Thanks so much problem is solved.