Avoid removing element that is load dynamically
Hye, i want to load tawk script which is the live chat. If I dont use SPA, everything works fine. However, when i use SPA, first load, the live chat button is show. but when i navigate to another page, the element that the script load dynamically is gone. I load the script using registerRenderHook and also try using FilamentAsset::register. Below is the script.
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 = '';
s1.charset = 'UTF-8';
s1.setAttribute('crossorigin', '*');
s0.parentNode.insertBefore(s1, s0);
})();
Thank you
0 Replies