Neos deletes bodyscripts by navigate throught nodetree

Hello everybody, last week i ask for a solution in slack because my neos instance deletes the body scripts by navigating trough the nodetree.

I can’t find a solution until now. So i install a clean neos instance with the demo package.
Surprise! there is the same problem! Is there somebody who knows something about this issue?

Way to reproduce it:

  1. Install neos demo (or other site)
  2. Login to Backend
  3. Reload Browser Window
  4. Check the bodyscripts after footer section with your inspector (there are three bodyscripts of demo package)
  5. Navigate in the nodetree
  6. Check the bodyscripts again, the three scripts are disappeared!

Is there someone how can help me?

Thanks

Benjamin

Interesting, can confirm this happens. Now to figure out WHY it happens…

Let’s move discussion over to:

as this is clearly a bug.

Just gonna post my answer here as well so people can find it.

To share some insights here, this is nothing new and has been like this since before the first alpha. It’s jQuery that prevents inserting scripts loaded via AJAX into the DOM for security reasons.

Instead of relying on scripts in the body being executed when navigating in the backend, try to bundle the JS in a way it always included and use the Neos.PageLoaded JS event to trigger scripts if the newly loaded content matches. See https://neos.readthedocs.io/en/stable/ExtendingNeos/InteractionWithTheNeosBackend.html

Lastly the new refactored UI won’t have this issue since it’s using an iframe where security isn’t an issue and scripts are executed when the iframe url is updated.

1 Like