Hi
I would only like to switch between the offline and the online base layer depending on whether it is connected to the internet or not. Currently it uses the NaturalEarthII base layer by default, how can I do this?
- Should I check connectivity to the Ion?
- Would it be better to check every few seconds or on refresh?
Hi,
U can use window events to check the connectivity to the Internet. Depending on that u can just use a fallback if ur offline.
-
Check the connectivity like this:
window.addEventListener(“offline”, goOffline);
window.addEventListener(“online”, goOnline);
-
Declare ur 2 functions: goOffline and goOnline. Depending on the function set the imageryLayer.
1 Like