Preload script in Webview

I know that you can use the preload in webpreferences, but this seems to only load the preload script one time when the browser window is opened. I need it to load everytime I navigate to a new site. I used the preload script within the webview tag like this

This worked fine before, earlier in the project, but now I’m getting nothing in the console, no errors it’s just not loading, not even once. The other way works, but only one time. I’d appreciate any help.