Depending on what IE versions you need to support, you can check navigator.onLine
to see if the browser thinks it's online or not.
Otherwise, try wrapping it in a try{}
/catch(){}
block.
Question
In IE, if you lose internet connection or are in offline mode, and you try to set location.hash like this:
location.hash = '#anythinghere'
It throws an "Unspecified error". Is there a way to know beforehand if setting location.hash will fail?
Solution
Depending on what IE versions you need to support, you can check navigator.onLine
to see if the browser thinks it's online or not.
Otherwise, try wrapping it in a try{}
/catch(){}
block.