Updating body element #882
-
Describe your problem 🧐Hello, After several attempts, I haven't been able to find a solution. In my website, I retrieve scripts via the backend, which are then injected onto a page. During the initial visit, the chat appears correctly. However, during navigation, the chat no longer appears. I've tried several plugins (head, script) and tags (data-ignore-script, data-swup-reload-script), but the issue persists. Here's an example of the script generated after processing on the backend: If anyone has suggestions or insights on how to resolve this issue, I'd greatly appreciate it. Thank you. What is your question? 🙋♀️How can I load this snippet of code so that it will be executed in the DOM as expected? I'd like to clarify that these are scripts loaded from the backend, inserted by the user, and then loaded and injected into the section of the layout. URL to minimal reproduction 🔗workinlocal Checked all these? 📚
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hello ✌️ Can you share a link to the site in question? Or the exact markup of the site? I'm afraid this is impossible to debug without access to an actual demo. |
Beta Was this translation helpful? Give feedback.
-
I see. Swup doesn't support swapping out the whole body. You've set |
Beta Was this translation helpful? Give feedback.
I see. Swup doesn't support swapping out the whole body. You've set
<body id="swup">
. If you pick another element down the tree (like amain
element, i.e. your main content container), it should work as expected. If your chat widget is outside of that main content container, it will not be modified and just work as expected.