Overriding "Content missing"?

Is there a way to customize this html and content?

<strong class="turbo-frame-error">Content missing</strong>

3 Likes

Yes. You need to intercept the correct event and preventDefault. Here is an example of what I have defined globally:

document.addEventListener('turbo:frame-missing', (event) => {
  event.target.innerHTML = `My custom content`;
  event.preventDefault();
})