Multiple Rocket.Chat widget added when moving back and forth on the website.
If I have the Livechat script added on a webpage and if go back a few page and then come to the page having Livechat script, multiple widget get added one above the other resulting in the widget to freeze.
Have deployed a fix on my website with the following addition in the Integration script:
<!-- Start of Rocket.Chat Livechat Script -->
<script type="text/javascript">
**if (document.getElementById('rocketchat-iframe') == 'undefined' || document.getElementById('rocketchat-iframe') == null)
{**
(function(w, d, s, u) {
w.RocketChat = function(c) { w.RocketChat._.push(c) }; w.RocketChat._ = []; w.RocketChat.url = u;
var h = d.getElementsByTagName(s)[0], j = d.createElement(s);
j.async = true; j.src = '**************************';
h.parentNode.insertBefore(j, h);
})(window, document, 'script', '************************');
**}**
</script>
<!-- End of Rocket.Chat Livechat Script -->
Not sure if this is the right way to address the issue, please have a look at this, kind of a big issue if you need to move along the website too frequently.
Hey @deep0892 you could do a pull request with the fix, it would really help out! Thanks!
@MartinSchoeler , i dont know if this is the right fix to do, that's why I didn't do a PR!
It works for the time being and i am on a deadline to move things to productions, so i am going with the fix, love to know if any of the developers have a better solution. If not i would love to do a PR.
Hi @deep0892. Sorry for the late reply but we want to know if the issue you described was fixed at that time because we didn't get any other similar issue since then.. Can you please give us an update about it?
Thanks.
Hi @deep0892!
I'm closing this issue but feel free to open it again if you notice that the problem is still happening. Thanks.