Online Or Offline (ing)

Konu sahibi son olarak 3355 gün önce görüldü
Kullanıcılara ilgili adres içerisinde online mı yoksa offline mı olduklarını bildirmenizi sağlar. Daha çok intranet sistemleri için kullanışlı bir kod.


Kod:
<script type="text/javascript">
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Mr J | http://www.huntingground.net/ */
function chk_url() {
  url=unescape(********.********)

  // enter the URL below you want to check
  if(url.indexOf("javascript.internet.com")!= -1){ // if this string is found
    alert("You are online") // do this if online
  } else {
    alert("You are offline") // do this if offline
  }
}

// Multiple onload function created by: Simon Willison
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  chk_url();
});
</script>
 
Geri