Jump to content

Script code


Guest

Recommended Posts

Can anyone advise where I would add some script code in 1.6

 

The code is for a live chat system.

 

The instructions say add this to your "html"

<!--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.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>
<!--End of Tawk.to Script-->
Link to comment
Share on other sites

Thanks for the reply. I tried in the header, but it does not work. I can see the code in source, and it has changed to

<script type="text/javascript">/* <![CDATA[ */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//default';s1.charset='UTF-8';s1.setAttribute('crossorigin','*');s0.parentNode.insertBefore(s1,s0);})();

Would that be right? There does not seem to be an </script> tag to close the script

Link to comment
Share on other sites

Thanks for the reply. I tried in the header, but it does not work. I can see the code in source, and it has changed to

Try the literal tag. If the problem persists then please post us you web site URL.

 

Are you using CloudFlare?

Link to comment
Share on other sites

it appears you area missing the ending </script>

 

post the code from header.tpl you are using...

 

I have put the code in the header.tpl as you said, the </script> tag is there as you can see here

<html lang="{$lang_iso}">
	<head>
	<!--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/52c482f0420ef4ad3a0000c0/default';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>
<!--End of Tawk.to Script-->

		<meta charset="utf-8" />
		<title>{$meta_title|escape:'html':'UTF-8'}</title>
{if isset($meta_description) AND $meta_description}
Link to comment
Share on other sites

OK, thanks for your help anyway - personally I think it is related to why all the modules are not updating and cant configure in 1.5 and 1.6

 

lets see what the next few days brings

Link to comment
Share on other sites

Well that JS code is moved to the end of the HTML source code by smartyOutputContent() method in classes/controller/Controller.php file. You can disable it by changing:

 

$dom_available = extension_loaded('dom') ? true : false;
to

 

//$dom_available = extension_loaded('dom') ? true : false;
$dom_available = false;

However it should not cause any issues, it does not really matter where Tawk.to JS is executed.

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...