You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I still haven't made sense of what is going on here, but I just discovered that the <noscript> content in my application.html.erb file was what was causing Turbo to duplicate all the script tags that are in the <head> into the <body>. This was causing Turbo to show the following warning every time I clicked on a navigation link to another page:
You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements
Inspecting the page markup shows that all my script tags were present in both the head and body. When I comment out or delete just the <noscript> tag content, this warning disappears and script tags remain only in the head element as they should. Inside the <noscript> tag I have just two elements, a Facebook <img> tracking pixel, and a Google Tag Manager <iframe>, however, this issue is reproducible just just adding something as simple as <noscript><img src="" /></noscript>.
Anyone have any idea what is going on here?
The text was updated successfully, but these errors were encountered:
Is there an easy way to get that bug report template to open the html in an actual browser window? The issue only causes a warning, so the test does pass, but I can't see if the warning is present or not.
I still haven't made sense of what is going on here, but I just discovered that the
<noscript>
content in myapplication.html.erb
file was what was causing Turbo to duplicate all the script tags that are in the<head>
into the<body>
. This was causing Turbo to show the following warning every time I clicked on a navigation link to another page:Inspecting the page markup shows that all my script tags were present in both the head and body. When I comment out or delete just the
<noscript>
tag content, this warning disappears and script tags remain only in the head element as they should. Inside the<noscript>
tag I have just two elements, a Facebook<img>
tracking pixel, and a Google Tag Manager<iframe>
, however, this issue is reproducible just just adding something as simple as<noscript><img src="" /></noscript>
.Anyone have any idea what is going on here?
The text was updated successfully, but these errors were encountered: