Is there a way to avoid the unity canvas to be reloaded on web page refresh?

I am creating a web application in asp.net in which in the main page there are a bunch of UI controls + the unity canvas. Somehow the canvas displays a 3d model who is controlled by UI widgets.

on page refresh the unity canvas is reloaded from scratch, page refresh occurs twice:

  1. if the user explicitly refreshes the page using F5
  2. if the user opens another project (using the Load command i created who allows to load from the Database a previously saved project)

since my unity canvas in principle should be loaded only once because once it is loaded and initialized all i need to do is send messages to it with javascript it makes no sense to load the canvas more than once. I’d like to obtain this because loading the unity canvas takes a lot of time.

Is there a way to tell the canvas not to reload?

I did not find anything about html5 canvas about this, but may be i am wrong or there is some unity specific command to perform this.
Thanks.

I dont think so…

you could probably block manual refresh/f5 with javascript,
but if your page changes on #2, then new page will load no matter what (some parts of unity player should be cached though…)

For #2, if page changes, you could have unity player or your project page in a separate iframe, so then you can load project url, without reloading whole page…

also webassembly player felt like faster to init, have you tried it?

Thanks for the reply. Could you please explain me more about what you mean with webassempbly player faster to init? THanks

5.6 and later versions, can output webassembly player for browsers
https://blogs.unity3d.com/2017/03/31/5-6-is-now-available-and-completes-the-unity-5-cycle/

if webassembly speeds up the init time it is a great thing. From a practical point of view is this just a compiler switch or does it require many changes ?

I installed unity 5.6 but in webGL build settings i see no changes, does it mean webasembly is automatically used from now on? Thanks.

I think it was in Player Settings somewhere [×] webassembly

The WebAssembly checkbox is under Publishing Settings in PlayerSettings. Though be mindful that browser support for WebAssembly is still new and not all browsers support it which will cause it to fallback to JavaScript. Some browsers will see the speed increase others may not essentially.