Suppose I wish to make my website automatically become unavailable every week during Shabbat, or at least for a time period that roughly corresponds to Shabbat for a large group of people. Can you give me any specific technical advice on how to go about this? Bonus points for any suggestion that allows this behavior to be dependent on the probable location of the user, based on their ip address for example.
|
|
There is actually a company in Israel that offers this as a service. Their website is here. |
|||||||
|
|
The technical implementation belongs on StackOverflow. I would suggest (as stated elsewhere here) to use the user's time zone. However, I would not use geolocation, I'd rather use JavaScript or something to get local time from the computers clock and use geolocation for calculating the zmanim. |
|||||||||||||||||||
|
|
[edited to reflect recent experiences as well as newfound technical knowledge] Fair WarningWhile I don't see the point of doing so, I would highly suggest that instead of making it completely unavailable, put up a page with something along the lines of: "it's Shabbos so we're closed. Check back soon". I would additionally suggest that you give the user an option to "continue anyways" at their own risk (In OP's case it may not matter, but in most other websites' cases it will make a difference. Indeed, while visiting a website to research information for a question posted on JL&L, I came across a learning-oriented website which automatically redirected me to a "sorry, we're closed for Shabbos page" --- except it was not Shabbos yet for me! Without any other option, I was forced to leave the site. (For the record it was late Friday afternoon, but still over an hour before sunset) While that particular website was indeed preventing Chilul Shabbos, they were at the same time preventing me from learning about an interesting Jewish topic. Moral of the story: Be absolutely sure your technical implementation is airtight before killing the website for users... Technical ImplementationWith the fair warning in mind, it's hard to give a one-size fits all approach. Essentially there are three problems:
The most elegant solution would be to do the redirect server-side. So the first thing we can try to do is get the users location for the timezone by using IP Geo-location: Except... IP Geo-location is a mess: it may seem to work right many times, but that only holds true if an IP always reflects a user's location. Which it doesn't (proxy server, dial-up, bad info, etc.). Just from my own personal experience, I punched my IP into http://www.ip2location.com/, and it told me I was in Massachusetts. Sorry, but a simple reading of my profile on this site will tell you I'm in NY. So without an accurate way to identify the user's precise location, we can only go for tackling problem #2. By using Javascript (again, less elegant), we can get a client's timezone. The only thing that remains is what time Shabbos is. Once again, if IP Geolocation was accurate we could get it from there. A possible solution to this problem is to be lenient. In other words, in a given timezone (which we know the user is in), what's the latest possible sunset? If the user's time is past that, then redirect, otherwise keep him here. Finally, as for problem #3: you can actually output the server's GMT time [I would sincerely hope it's accurate!] directly into the Javascript code, and do the evaluation on the client side using that value. Bottom LineIf you absolutely must implement such a system, be very careful with your technical implementation. The best route would probably be along the lines of some combination of client and server side detections, but you still have a small risk of locking out some users. But is it really worth the hassle? [if you're going with the third-party service route, I would highly suggest finding out how they handle the issues I raised - especially what the probability of a false-positive is] |
|||||||||||
|
|
SaturdayGuard has a system to do prevent people from going on your site when THEY (the readers) have Shabbos, and they have Rabbinical Approval from the Chief Rabbi of Israel (as well as others) |
|||
|
|
|
Drupal plug-in exists here: http://drupal.org/project/shabbat |
|||
|
|
