簡體   English   中英

刷新頁面時清除 Freshchat

[英]Clear Freshchat when refreshing page

嘗試在頁面刷新后清除聊天。 我嘗試使用下面的代碼並不斷收到“出現問題。你沒有連接”。 任何人都可以訪問聊天,該網站沒有登錄功能

<script>
        window.fcWidget.user.clear().then(function () {
            console.log('User cleared');
        }, function () {
            console.log("User Not cleared");
        });
</script>

<script>
        window.fcWidget.init({
            "config": {
                "cssNames": {
                    "widget": "chat"
                }
            },
            token: "API_KEY",
            host: "https://wchat.freshchat.com"
        });
</script>

您應該在清除小部件之前對其進行初始化。

  <script>
        window.fcWidget.init({
            "config": {
                "cssNames": {
                    "widget": "chat"
                }
            },
            token: "API_KEY",
            host: "https://wchat.freshchat.com"
        });
</script>

    <script>
        window.fcWidget.user.clear().then(function () {
            console.log('User cleared');
        }, function () {
            console.log("User Not cleared");
        });
</script>

也可能值得將其包裝在 document.ready() 中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM