-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Happyfox Chat loading problem after language change #67
Comments
Do you still face that issue? If yes, can you drop a mail at [email protected] ? |
AFAIK, Rails I18N will not cause the widget to reload several times. |
@TehraniX: HappyFox Chat is one of the very few live chat tool that supports Rails Turbolinks. To prevent widget reloading please refer https://support.happyfoxchat.com/kb/article/608-turbolinks-support-in-happyfox-chat Option A: Installs widget in all the pages: <head>
...
...
<!--Start of HappyFox Live Chat Turbolink Script-->
<script>
document.addEventListener('turbolinks:load', function () {
try {
window.HFCHAT_META.digested = false;
} catch (error) {}
window.HFCHAT_CONFIG = {
EMBED_TOKEN: "<Your Embed Token>",
ACCESS_TOKEN: "<Your Access Token>",
HOST_URL: "<Host URL>",
ASSETS_URL: "<Assets URL>"
};
(function() {
var scriptTag = document.createElement('script');
scriptTag.type = 'text/javascript';
scriptTag.async = true;
scriptTag.src = window.HFCHAT_CONFIG.ASSETS_URL + '/js/widget-loader.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(scriptTag, s);
})();
});
</script>
<!--End of HappyFox Live Chat Turbolink Script-->
</head> Option B - Install widget only in specific pages: <body>
...
...
<script>
try {
window.HFCHAT_META.digested = false;
} catch (error) {}
</script>
<script>
if (!document.getElementById('hfc-frame')) {
window.HFCHAT_CONFIG = {
EMBED_TOKEN: "<Your Embed Token>",
ACCESS_TOKEN: "<Your Access Token>",
HOST_URL: "<Host URL>",
ASSETS_URL: "<Assets URL>"
};
(function() {
var scriptTag = document.createElement('script');
scriptTag.type = 'text/javascript';
scriptTag.async = true;
scriptTag.src = window.HFCHAT_CONFIG.ASSETS_URL + '/js/widget-loader.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(scriptTag, s);
})();
}
</script>
</body> |
I was searching on happyFoxChat and ended here. and found this still open. this is what I have done for many kind of external scripts that I use in React:
|
I have a problem integrating the Happyfox Chat widget on my website. The standard procedure is to add the following code at the bottom of the body-area on the website:
<script> window.HFCHAT_CONFIG = { EMBED_TOKEN: "yourEmbedToken", ACCESS_TOKEN: "yourAccessToken", HOST_URL: "https://happyfoxchat.com", ASSETS_URL: "https://d1l7z5ofrj6ab8.cloudfront.net/visitor" }; (function() { var scriptTag = document.createElement('script'); scriptTag.type = 'text/javascript'; scriptTag.async = true; scriptTag.src = window.HFCHAT_CONFIG.ASSETS_URL + '/js/widget-loader.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(scriptTag, s); })(); </script>The problem is, that it is getting reloaded several times, when I change the language (via the I18n rails gem).
Does anybody know any solution to that problem?
Thanks!
The text was updated successfully, but these errors were encountered: