When connection returns, all I get is NULL for the anchors.
<script type="text/javascript">
setInterval(function(){ /*check ~every second*/
var status = navigator.onLine?'Menu Enabled!':'Menu Disabled!';
the first part sets an attribute when the connection is lost
var anchors = document.getElementsByTagName("a");
if(status == 'Menu Disabled!') { /*if connection is lost*/
for (var i = 0; i < anchors.length; i++) {
var href = anchors[i].href;
anchors[i].setAttribute("rel", href);
anchors[i].href = "javascript:;"
}
}
this part is supposed to remove the attribute and restore the anchor
if(status == 'Menu Enabled!') { /* if connection is reconnected */
for (var i = 0; i < anchors.length; i++) {
var href = anchors[i].getAttribute("rel");
anchors[i].removeAttribute("rel");
anchors[i].href = href
}
}
}, 1000);
</script