[英]Chat box getting disappeared after page reload/Refresh in Firefox
I have three radio buttons and a submit button.我有三个单选按钮和一个提交按钮。 Initially a contact box button will display in website, Upon clicking the button, these three buttons will appear.
最初网站上会显示一个联系框按钮,点击该按钮后,会出现这三个按钮。 We can select and we need to click one of them.
我们可以选择,我们需要点击其中之一。 Two radio buttons are for displaying popups and next one is for displaying live chat box.
两个单选按钮用于显示弹出窗口,下一个用于显示实时聊天框。 So I have written the following code for this.
所以我为此编写了以下代码。 Please see the link: https://pastebin.com/RgD0vuB1
请查看链接: https : //pastebin.com/RgD0vuB1
I have implemented the code.我已经实现了代码。 But I faced two issues:
但是我遇到了两个问题:
First Issue: I used setInterval and clear interval for hiding the livechat box at first(hiding with its id/class didn't worked).第一个问题:我首先使用 setInterval 和 clear interval 来隐藏实时聊天框(隐藏其 id/class 不起作用)。 Added the following code:
添加了以下代码:
=================== ====================
<script>
var timer = window.setInterval(function(){
jQuery('#customer-chat-iframe').css("display", "none");
}, 0);
</script>
=================== ====================
The chat is hidden initially.聊天最初是隐藏的。 But upon refreshing the page, even if i gave zero delay, chat box is showing like a blink and suddenly disappeared.
但是在刷新页面时,即使我给了零延迟,聊天框也会像眨眼一样显示并突然消失。 I dont want to show chat box blinking even for a small time.
我不想让聊天框闪烁一小会儿。
Main Issue:主要问题:
I selected chat radio button, submitted and started chatting.我选择了聊天单选按钮,提交并开始聊天。 Chat has both user and admin end.
聊天有用户端和管理员端。 So when chat begun, if i refresh the page (user end - FireFox (55.0.2) ), and then again click on Chat radio button, live chat box is getting disappeared.
因此,当聊天开始时,如果我刷新页面(用户端 - FireFox (55.0.2) ),然后再次单击“聊天”单选按钮,实时聊天框就会消失。 So that from customer end, he/she is not able to do futher chat.
因此,从客户端,他/她无法进行进一步的聊天。 But the issue is not in chrome.
但问题不在于铬。 Even if we refresh the page, after clicking the radio button, the chat continues without missing anything.
即使我们刷新页面,单击单选按钮后,聊天仍会继续而不会丢失任何内容。 Do you know why?
你知道为什么吗? I am sitting with this for a long time.
我坐了很长时间。 This code works well for Chrome.
此代码适用于 Chrome。
So please help guys.所以请大家帮忙。
Thanks谢谢
You have to clearInterval(timer) then it will work as you expected.您必须 clearInterval(timer) 然后它会按您的预期工作。 Hope this helps.
希望这会有所帮助。
var timer = window.setInterval(function(){
jQuery('#customer-chat-iframe').css("display", "none");
}, 0);
window.clearInterval(timer);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.