Our customers wants us to use third party Cookie consent scripts, such
as Cookie Information, most of these
needs to modify the dom based on some data returned after a network call.
This is fundamentally incompatible with Browser.application which breaks
if DOM elements are added to the
<body> by other scripts.
Different versions of this problem have been discussed before here and
The previous OP’s had a problem with browser extensions that randomly edit the DOM, or with third party analytics
extensions that do the same.
We tried patching the generated Js code, so that the elm app is actually initialized
in an element nested inside the body, as suggested in this post. The proposed solution actully seems to work, but patching the generated Js is
obviously a very brittle and unsatisfying solution.
We also considered moving our application to a Browser.element model and handling
the navigation stuff with ports as suggested in this post, but we have a really large application and it would be much more difficult to rely on such a system rather than the build
in Navigation module.
Because the above “fix” works, it seems it would be easy to just allow the
Browser.application to be started in some other node, like Browser.element.
Is there some reason why this option is not just enabled? It seems like it would
enable many devs to use the Browser.application module in production, where today
they are forced to use Browser.element or patch code etc.
Is anyone aware of other approaches that might work?