Replies: 1 comment 2 replies
-
Unless I am misunderstanding what you are saying, sounds like you have an SPA. The reason it triggers on the first page but not subsequent pages is likely because the initial page is a full render of HTML in which the browser will evaluate header-defined scripts, while subsequent pages are being performed by Svelte's updates to the DOM - these won't trigger the header (as far as I am aware). If you want to trigger some Javascript on each page, you can look into the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In my test application using Sveltekit, I tried to inject third party scripts to page using
The above code works fine on direct hit of the page but not during manual navigation to the page. The same thing work if I use
The above script will work even on page navigation but the script code is not dynamic
But I wish to add scripts dynamically per page. I read somewhere that browser for safety reasons will not execute scripts added dynamically. It accepts only sanitised one's.Is there any easy workaround
Stackoverflow link - https://stackoverflow.com/questions/78112514/dynamically-injected-script-execution-not-working-on-page-navigation-using-svel
Beta Was this translation helpful? Give feedback.
All reactions