BrU32

JS Check Your Connection Status Constantly

Jul 15th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <script>
  2. var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
  3. var type = connection.type;
  4. function updateConnectionStatus() {
  5. if(connection.type=='none'){
  6. document.writeln("<center><body bgcolor=000000><h2><font color=skyblue>No Connection Found!!<br><br></h2>");
  7. }else{
  8. document.writeln("<center><body bgcolor=000000><h1><font color=skyblue>Connection Established!!<br><br></h1>");
  9. }
  10. }
  11. connection.addEventListener('typechange', updateConnectionStatus);
  12. </script>
Advertisement
Add Comment
Please, Sign In to add comment