Question

I'm having some troubles using CrossriderAPI with turbolinks, my scenario is this:

1. Going on my http://website.local/

2. running a check to see if Crossrider extension is ready:

CrossriderAPI.isAppReady('xxxxx', function(r) { if (r) (console.log('ready')) })

3. yes of course, is it.

4. Navigating through the website (using turbolinks)

5. well, troubles start by here. turbolinks change the DOM to each request, but when I retry to check if Crossrider extension is ready, and I'm investigating why, what i receive is false. It seems not see anymore our extension.

I'm debugging this code to see if I get out from this problem.

has anyone succeeded with this? Any help or advice would be great!

Antonio

Was it helpful?

Solution

I am not familiar with Turbolinks, but in general based on their GitHub readme that states that "you can't rely on DOMContentLoaded or jQuery.ready() to trigger your code", I would think that it severely impedes extensions that rely on these events as they run when the page loads.

Specifically in this instance, since Turbolinks replaces the body content, it disrupts the CrossriderAPI library that utilizes the DOM content for its operation. Hence, without considerable reworking of the code, I don't think that Turbolinks can co-exist with the CrossriderAPI and can disrupt with extension functionality.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top