Not sure in what version of mendix you are working but I would always advise to use javascript actions instead of the HTMLSnippet widget, that way you are sure it will fire and its more easily debuggable. If you need to fire it on page load you can use the Events widget to fire a nanoflow with the javascript action.
Also once you set that up correctly and it still doesnt work you can add the line "debugger;" somewhere in your code and if you run it then locally and open your console.log when the script is fired you can debug the javascript in the console.
Have you tried to turn on the 'Refresh' fields shown in the picture below?
@Hunter Koppen. Thank you, I will try this
@Vinicius Strugato Amrbosio.
Yes thank you, I have already tried this! Still not working!
Thanks to Hunter Koppen I can assure, that the javascript is executed.
I have noticed though, zooming and scrolling does not change anything in the
window properties? For example window.scroll>, window.innerWidth values are not changed when I zoom in the page or scroll down.
Can this be an issue with additional corporate styling in the page?