Source

jsTimezoneDetect / index.html

Full commit
Jon Nylander d4f10af 

Jon Nylander 6e604f5 



Jon Nylander f8f5d4d 




Jon Nylander d17aca6 

Jon Nylander d4f10af 
Jon Nylander 8a9f4e5 




Jon Nylander d17aca6 


Jon Nylander 8a9f4e5 






Jon Nylander d17aca6 


Jon Nylander 8a9f4e5 


Jon Nylander d4f10af 




Jon Nylander d17aca6 

Jon Nylander 8a9f4e5 



Jon Nylander 1105db6 
Jon Nylander d4f10af 
Jon Nylander 1105db6 

Jon Nylander 8a9f4e5 
Jon Nylander d4f10af 
Jon Nylander 1105db6 

Jon Nylander d17aca6 

Jon Nylander d4f10af 






Jon Nylander 99320be 
Jon Nylander d4f10af 










Jon Nylander d17aca6 

Jon Nylander d4f10af 












Jon Nylander d17aca6 



Jon Nylander 8a9f4e5 
Jon Nylander d17aca6 





Jon Nylander 996c809 
Jon Nylander d17aca6 

Jon Nylander 59980a8 
Jon Nylander 8a9f4e5 
Ilya Sedlovsky 9954bee 

Jon Nylander e0b4268 
Ilya Sedlovsky 9954bee 














Jon Nylander 6e604f5 



Jon Nylander 996c809 
Jon Nylander d4f10af 
Jon Nylander d17aca6 

Jon Nylander 1105db6 
Jon Nylander d4f10af 
Jon Nylander 99320be 
Jon Nylander d4f10af 



Jon Nylander 8a9f4e5 
Jon Nylander d4f10af 


Jon Nylander 8a9f4e5 
Jon Nylander d4f10af 






Jon Nylander 6e604f5 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html>

<head>
  <title>Automatic time zone detection using JavaScript</title>
  <!-- 
  Script by Josh Fraser (http://www.onlineaspect.com)
  Continued by jon at pageloom dot com as jsTimezoneDetect.
  Open source on bitbucket.org.
  -->
  <style type="text/css">
  body {
    font-family: helvetica, sans-serif;
    background-color: #555;
    color: #fff;
    text-shadow:1px 1px 0px #000;
    padding: 0px;
    margin: 0px;
  }
  
  div#content {
    background-color: #333;
    width: 100%;
    border-top: 1px solid #fff;
    border-bottom: 1px solid #fff;
    -box-shadow: 5px 5px 3px #333;
    -moz-box-shadow: 5px 5px 3px #333;
    -webkit-box-shadow: 5px 5px 3px #333;
  }
  
  div#content p {
    width: 500px;
    margin-left: auto;
    margin-right: auto;
    padding: 3px 10px 3px 10px;
    text-align: left;
    font-size: 20px;
    line-height: 30px;
    font-weight: normal;
  }
  
  div#content p#tz_info {
    display: none;
  }
  
  p.info {
    width: 730px;
    margin-left: auto;
    margin-right: auto;
    font-size: 12px;
    font-weight: normal;
    text-align: right;
    letter-spacing: 1px;
  }
  
  p.instructions {
    width: 520px;
    margin-left: auto;
    margin-right: auto;
    font-size: 13px;
    text-align: left;
    letter-spacing: 1px;
    line-height: 18px;
  }
  
  ul {
    width: 520px;
    margin-left: auto;
    margin-right: auto;
    font-size: 13px;
    letter-spacing: 1px;
    line-height: 17px;
  }
  
  h1 {
    text-align: center;
    margin-bottom: 0px;
  }
  
  h3 {
    width: 550px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 20px;
    margin-bottom: -5px;
  }
  
  h3.omg {
    color: green;
  }
  
  a {
    border-bottom:1px solid #A7A7A7;
    color:#bdf;
    line-height:20px;
    white-space:nowrap;
    text-decoration: none;
  }
  
  a:hover {
    border-color: #fff;
  }
  </style>
  <script type="text/javascript" src='detect_timezone.js'></script>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
  <script type="text/javascript">
  $("body").ready(function () {
        var tz_info = jstz.determine_timezone();
        
        response_text = 'No timezone found for ' + tz_info.key;
        
        if (typeof(tz_info.timezone) == 'undefined') {
            response_text = 'No timezone found for ' + tz_info.key;
        }
        else {
            response_text = tz_info.timezone.display(); 
        }
        
        document.getElementById('tz_info').innerHTML = response_text
        
        $('#tz_info').fadeIn(3000);
    });
  </script>
</head>

<body>

<h1>Automatic Timezone Detection Using JavaScript</h1>
<p class="info">This script is open source and hosted as <a href="https://bitbucket.org/pellepim/jstimezonedetect"/>jsTimezoneDetect @ Bitbucket</a>.</p>
<div id="content">
<p id="tz_info"></p>
</div>
<h3>How do I test this script?</h3>
<p class="instructions">To test the detection script, simply change your system timezone and refresh this page. In Chrome and Opera you will have to open a new tab (and sometimes restart) for the new timezone to be detected.</p>
<h3>What is the Olson Database?</h3>
<p class="instructions">The Olson database, also known as the <strong>tz database</strong>. Is a public domain collaborative compilation of information about the world's timezones.</p>
<p class="instructions">It is widely used as basis for timezone information in operating systems and software. Most platforms and programming languages have libraries that support it.</p>
<p class="instructions"><a href="http://en.wikipedia.org/wiki/Tz_database">More at Wikipedia!</a></p>
<h3>I don't like the timezone this script gives me!</h3>
<p class="instructions">This script does not do geolocation. It simply picks the most populated timezone among several roughly identical ones.</p>
<p class="instructions">For example, it is impossible to distinguish between different cities in Europe. This script will return Europe/Berlin regardless of where you live in the Central European timezone.</p>
<p class="instructions"><a href="https://bitbucket.org/pellepim/jstimezonedetect/wiki/Detection_List">Click here for the list of timezones this script is able to detect</a>.</p>
<h3>NO CAN HAZ TIMEZONEZ?!?11</h3>
<p class="instructions">If this script fails to correctly determine your timezone, <a href="https://bitbucket.org/pellepim/jstimezonedetect/issues/new">Please report it!</a></p>
<p class="instructions">When you report an issue. Please tell us </p>
<ul>
    <li>what timezone your computer is set to,</li>
    <li>what operating system you use, and</li>
    <li>what browser you use.</li>
</ul>
</body>
</html>