2

我不断收到此错误:第 5 行错误,字符 2:解析错误。预期的主要表达

这是自定义 HTML 的样子:

<script type="text/javascript">

//paste your Tawk embed code here, without Script tags

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

谁能帮我吗?

4

1 回答 1

1

<script>您的原始代码中有第二个标签,这是无效的。它应该如下所示:

<script type="text/javascript">

    //paste your Tawk embed code here, without Script tags

    var Tawk_API=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/5a2863145d3202175d9b6c41/default';
    s1.charset='UTF-8';
    s1.setAttribute('crossorigin','*');
    s0.parentNode.insertBefore(s1,s0);
    })();

</script>
于 2018-11-30T20:24:53.120 回答