Comments (9)
Try using the first method, but add these lines to the beginning of the script:
delete(window.LC_API);
delete(window.LC_Invite);
delete(window.__lc_iframe_current_skill);
delete(window.__lc_inited);
delete(window.__lc_lang);
Let me know if that works.
from turbolinks-compatibility.
livechat = function() {
var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
};
$(document).ready(livechat);
$(document).on('page:ready', livechat);
gives this error:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://secure.livechatinc.com') does not match the recipient window's origin ('http://www.mytestwebsite.test').
from turbolinks-compatibility.
Excellent, thanks @reed
This works:
(function() {
delete(window.LC_API);
delete(window.LC_Invite);
delete(window.__lc_iframe_current_skill);
delete(window.__lc_inited);
delete(window.__lc_lang);
var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
})();
If you'd like, I can fork and add this one?
from turbolinks-compatibility.
That'd be great. One thing you might consider changing is in the last line, using document.body.getElementsByTagName
instead of document.getElementsByTagName
. That way you won't end up with duplicate script tags in the head as you navigate the site. It doesn't really make a difference, functionality-wise, so just do whichever you prefer.
from turbolinks-compatibility.
I keep getting "Script Error" on loading my site. What might be the reason and wat might fix it?
from turbolinks-compatibility.
Do you have a bit more info? Is "Script Error" a console error or just straight in the website? Can you include the javascript that's causing the error?
from turbolinks-compatibility.
I'm getting a warning message @ console saying that like attached. Hence the live chat won't appear at my website.
from turbolinks-compatibility.
Hi, I tried that solution and it actually works, but throw this errors on the console:
Any thoughts?
from turbolinks-compatibility.
I leave this approach here, maybe is useful to somebody else:
This code loads the script widget in all pages, but in some pages Turbolinks replaces the DOM, loosing the HTML for rendering the widget.
We use LivechatWidget.call('destroy')
to kill the widget and then call the function that bring it back on those cases, that's why we use those 2 event listeners. And the property data-turbolinks-eval="false"
on the script tag is important.
from turbolinks-compatibility.
Related Issues (20)
- Turbolinks not working with google ads or LiveHelpNow
- Google Tag Manager HOT 5
- Facebook like/share button still disappearing HOT 1
- Marketo munchkin tracker integration request
- Integration with Google TagManager HOT 4
- Happyfox Chat loading problem after language change HOT 4
- Can't find a way to change Facebook language HOT 1
- Loading Javascripts Problem HOT 1
- React Native HOT 1
- Turbolinks 5 compatibility HOT 8
- Should the solutions propose both coffee script and standart js version?
- Segment.com HOT 1
- Olark Hummingbird theme
- New Sharethis implementation and Turbolinks' incompatibility HOT 3
- owlCarousel not Loaded
- Zendesk old and new tab displayed HOT 2
- Turbolink 5 and Google DFP not working
- LiveZilla Compatability
- Using the Freshdesk/Freshdesk Widget with Turbolinks HOT 4
- SaleForce Widget with turbolinks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turbolinks-compatibility.