I have an offline html, and I add an Iframe inside it that redirect to a site if there's connection available. but in case if there's no internet connection the Iframe will redirect to offline page/html.
Can someone explain to me what code that I need to use? I'm using checking internet connection script but i don't know what code that I need to insert inside javascript for exchange alert('You are Online') > redirect to online site and alert('You Are Offline') > redirect to offline page
if(navigator.onLine)
{
alert('You are Online');
}
else
{
alert('You are Offline')
}
<iframe height="500px" width="100%" src="http://example.github.io/" id="foo"></iframe>
<div style="text-align:center"> This Iframe </div>