Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

Turbolinks complain about loading from <body>, while script is not in <body> #607

Open
adaamz opened this issue Mar 16, 2021 · 0 comments
Open
Labels

Comments

@adaamz
Copy link

adaamz commented Mar 16, 2021

Describe the bug

turbolinks.js:6 You are loading Turbolinks 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://github.com/turbolinks/turbolinks#working-with-script-elements

——
Suppress this warning by adding a `data-turbolinks-suppress-warning` attribute to: <script type="text/javascript" src="/static/js/compiled_ts.js" data-turbolinks-eval="false"></script>

To Reproduce
A minimal demonstration of the issue can be really helpful, and will speed up our response time. Try remixing the Turbolinks demo on Glitch: https://turbolinks-demo.glitch.me/

Steps to reproduce the behavior:

  1. place turbolinks initialization script after
  2. load page
  3. see warning

Expected behavior
No warning

Details:

  • Operating System: Windows 10
  • Browser: Opera 74.0, Firefox 78.7, Chrome 89.0
  • Turbolinks Version: 5.2.0

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

@adaamz adaamz added the bug label Mar 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant