Floating menu takes extra time to build up

I can confirm that with floating webview, if I check the "Do NOT keep content active in background (reduces memory usage, takes longer to show)" then the same behavior - it takes around 1sec to load the menu. However with the floating webview, even if this is unchecked, meaning the webview is active in background, there's no need for the JS you provided here.