To do that properly would require quite a bit of code and might not be possible. If your links are more or less ordinary a tags, put these scripts in the head of the page as an experiment:
Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).on('click', 'a', function(e){
e.preventDefault();
var href = this.href;
$(new Image()).on('error', function(){
alert('Check Your Internet Connection');
}).on('load', function(){
window.location.href = href;
}).attr('src', '1by1.gif?load=' + new Date().getTime());
});
</script>
Make sure there's an image 1by1.gif in the same folder as the page. It should be a very small .gif image.
Try your links both when connected and when not. If it works out, it can be elaborated. It does in this simple form depend upon the links being more or less ordinary links. They can have fancy layout and hover effects, but they need to be something like:
Code:
<a href="somepage.htm">Link Text or img tag</a>
And be aware that browsers do provide notifications when the user is offline, so duplicating that effort seems like a bit of a waste of time.
The browser cache may need to be cleared and/or the page refreshed to see changes.
If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
Bookmarks