JS is used to determine whether the user is connected to the Internet or not
- 2020-03-30 01:03:09
- OfStack
As follows:
<HTML xmlns:CAP>
<HEAD>
<TITLE>JS Check if the user is online </TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=gb2312">
<style>
@media all {CAP\:clientCaps {behavior:url(#default#clientcaps)}}
</style>
<script for=window event=onload>
if (oClientCaps.connectionType=="online")
{
sType.innerText="Internet Welcome you! ";
}
else
{
sType.innerText=" Why aren't you online? ";
}
</script>
</HEAD>
<BODY>
<CAP:clientCaps id="oClientCaps" />
<div id=sType></div>
</BODY>
</HTML>