0

Im trying to learn the timezone-js I got from here. I think I followed the instructions on how to get started. I downloaded all the necessary files including the Olson files but Im getting this error when I check my firefox console: Error: Error: Error retrieving "../files/tz/northamerica" zoneinfo files.

My code is (jtimezone.html):

<html>
<head>
<script type="text/javascript" src="../javascript/jquery/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../javascript/timezone-js/src/date.js"></script>
<script type="text/javascript">
$(document).ready(function () {
    timezoneJS.timezone.zoneFileBasePath = "../files/tz";
    timezoneJS.timezone.defaultZoneFile = "asia";
    timezoneJS.timezone.init();

    var dt = new timezoneJS.Date('10/31/2008', 'America/New_York');
    alert(dt);
});
</script>
</head>
<body>
</body>
</html>

I think I have set the file path for the zoneFileBasePath. Anyway my html is located at /home/idiotboy/Documents/timzone_test/html. The downloaded timezone-js is at /home/idiotboy/Documents/timzone_test/javascript. The tz files are at /home/idiotboy/Documents/timzone_test/files.

Please help. If you can suggest a better/easier way to handle timezones in javascipt please do. Im still a beginner. Thanks.

1
  • Is there any way you can test by serving these files through a web server instead of local file system? Commented Oct 17, 2012 at 4:41

1 Answer 1

1

Browsers don't allow AJAX to access local filesystem. You'll need to serve you page through Apache or Nginx and open your html with the URL localhost or 127.0.0.1

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.