在线聊天优化,遇到的问题

使用

<script language="JavaScript"> 
//image对象的载入问题
    var checkImg = new Image();
    checkImg.onload = checkImgOnload;
    function checkImgOnload()
    {
        var w = checkImg.width;
        if (w == 2)
        {
            /* You can add any HTML code or script call to handle Online chat state here */
            setCookie("chat_status",1,30);
        }
        else
        {
            setCookie("chat_status",0,30);
            /* You can add any HTML code or script call to handle Offline chat state here */
        }
    }
    function refreshLink()
    {
        checkImg.src = "https://image.providesupport.com/online-presence-image/rotita?t=" + (new Date()).getTime();//通过获取时间戳来确定客服的在线聊天客户端是否在线,客服不在线checkImg.width为1,客服在线checkImg.width为2)
    }
    refreshLink();
</script>

 

posted @ 2017-09-07 14:47  JasonXu_徐晓峰的博客  阅读(182)  评论(0编辑  收藏  举报