I want to load a specific scene if user is connected to internet and load a specific scene if user is not connected to internet
How about some jsscript (idk your network setup so i dont gaurantee if this works for u )
1.) => At beggining of the scene
// get scenevariable
var amIOnline = runtimeScene.getVariables().get("mystatus");
function checkServer(url, timeout) {
const controller = new AbortController();
const signal = controller.signal;
const options = { mode: 'no-cors', signal };
return fetch(url, options)
.then(setTimeout(() => { controller.abort() }, timeout))
.then(response =>
// if successful you are online else
amIOnline.setString("online")
).catch(error =>
// walang internet :-(
amIOnline.setString("offline")
);
}
checkServer("sample-url-to-check",2000);
2.) => Then compare the value of scenevariable ‘mystatus’ to be able to ChangeScenes
I only test this on my browser. It’s hard to check for internet connection even a simple window.navigator.onLine not effective in some situation… :-/
also take a look at CORS
There is an extension for checking that.
Tell me Name of that extension
Can u tell me how to use it for check internet availibliyy
You just use the condition Is Online?