-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
noscript tags prevent head contents from updating #40
Comments
Hi 🥦
|
Hi,
Yes crash is not the right word, sorry about that. When I inspect the element, I can see every |
Alright, I've renamed the issue to reflect what seems to be happening here. To narrow this down, here's a few suggestions:
|
Ok I got it after a flash of lucidity : The problem is coming from the tags : <noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=blabla&ev=PageView&noscript=1"
/></noscript>
// and
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=blabla&fmt=gif" />
</noscript> Removing them fix it. |
Okay, so it's the |
I've done a little investigating and this seems to be an issue with how browsers treat See this section on MDN about DOMParser.parseFromString:
|
noscript
tags prevent head contents from updating
noscript
tags prevent head contents from updating
@Tanguy-Magnaudet I think I've found the culprit. If the DOMParser encounters child nodes inside a The browser itself seems to be more lenient and allows The proof is that using valid head tags like <!-- doesn't work: won't find new stylesheets -->
<noscript><img height="1" width="1" src="https://www.facebook.com/..." /></noscript>
<!-- works: loads new stylesheets -->
<noscript><meta name="noscript" content="Noscript in head" /></noscript> The solution here is easy: move the I'll close this for now as there's not much we can do on the library side. |
We'll add a warning to the readme for people trying to debug this in the future. |
Description of the issue
I want to add GA, Linkedin & Facebook Pixels tracking scripts in the head of my pages, it makes the styles disappears when I change the page, but not my JS from Astro. It also log replicated GA / FB / Linkedin tracking instance.
I tried to use the scripts-plugin with optin enabled but it doesn't solve the issue.
Is there something I'm doing wrong ? What should I do to make it work ?
I know there is a GA Plugin, but since I have also FB pixel & Linkedin Tracking I'd like a solution that can be replicable to these 2 other scripts.
How to reproduce the issue
It's the head of my astro project :
Context and environment
The text was updated successfully, but these errors were encountered: