You could move it into the WebView element since it only seems to be needed there.
In any case, have you tried breaking down the code to the minimum that shows the problem?
E.g. does it with with just a WebView in the window.
With the WebView in an Item in the Window.
With the Item in a StackView as the initialItem.
and so on
Cheers,
_
Bookmarks