-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include inline JS script in head tag #52560
Comments
I also noticed on my end that the |
But |
I don't know, you may test to see. I think it should normally, but there may be mechanisms in place in app router to prevent that. If it does not appear in the head, you can still place the script in the body at the start, it will execute before the rest of the HTML has loaded (that's also what happens when putting an inline script in head). |
@ijjk Can u have a look on this? |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
https://github.com/ajaz-thiscar/nextjs-js-in-head
To Reproduce
Describe the Bug
In order to add google tracking code snippet in head of html document, we followed normal Script component in layout.js and a solution provided by NextJS webiste . The Script component is not placing js snippet in head tag.
Expected Behavior
The Next Script component should place the JS snippet in head tag instead of body tag.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: