Skip to main content
Question

Freschat iframe is empty after a Turbo.visit

  • April 4, 2025
  • 1 reply
  • 4 views

Forum|alt.badge.img

Hi there,

I’ve added the freshchat widget on my rails app but I’ve found this weird issue:

When I perform any Turbo.visit, the iframe containing the freshchat widget will just contain an empty <head> and an empty <body> tag

Setting “data-turbo-permanent” to the div or the iframe doesn’t fix the issue

 

I’m using rails 8.0.1 and turbo 8

Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img

The only fix I’ve found is to destroy the instance every time turbo finishes the visit:
 

document.addEventListener("turbo:before-visit", function () {

if (window.fcWidget) {

  window.fcWidget.destroy();

  }

});

 

I prefer to keep the same instance between navigations tho


Reply