/    Sign up×
Community /Pin to ProfileBookmark

internet connection

Hello,
I need for javascript for my webpage.
I use my page on my local computer
and want when onload the page, the
script to give me massage whether I have
internet connection or I havn’t. Is this possible with
javascript?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliAug 27.2003 — To find out if you have internet connection or not,you may be able to use a work around at [url=http://www.webapplikations.com/pages/html_js/document/FindOutAServerIsUp.html]this location[/url].

Its not the most reliable procedure(since the whole question is beyond the JavaScripts scope),it will work in most of the cases.
Copy linkTweet thisAlerts:
@vinsaauthorAug 27.2003 — I try with navigator.onLine(boolean). But it not work. Can you help me?

<html>

<head>

<title>check</title>

<meta content="text/html; charset=windows-1251" http-equiv=Content-Type>

<script type="text/javascript">

<!--

function check() {

if (navigator.onLine(boolean)) {

alert("you are online")

}

else {

alert("you are not online")

}

}

//-->

</script>

</head>

<body onload="check()" >

</body>

</html>
Copy linkTweet thisAlerts:
@NevermoreAug 27.2003 — I've been trying for ages, but my computer won't massage me either!

?
×

Success!

Help @vinsa spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...