Trying to create a navigator.onLine if/else function. HEELP!
This is for a mobile app, I have a button that opens a web page inside of an inApp Browser... but I want to check if there is an internet connection first. Can you fix my code below so that it works? Thanks!
<script>
function checkInternetFirst() {
if (navigator.onLine) {
openURL('
http://www.awesomewebsite.com
', '_blank', 'location=no')
} else {
alert( "Not going to work without internet." );
}
</script>