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.
[edited to reflect recent experiences as well as newfound technical knowledge]
While 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...
With the fair warning in mind, it's hard to give a one-size fits all approach. Essentially there are three problems:
- Users live in different places: Shabbos starts at different times
- Users live in different timezones
- Users don't always have the right time on their system clocks
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.
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.
If 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]
A more recent solution to this problem can be found here.
After inserting their code snippet into your webpage it blocks access to your website on Shabbos depending on your location, and instead transfers you to a page which tells the visitor what is happening. The service is completely free, but there is also a premium plan which allows you to control how much time before and after Shabbos your website closes, hide their logo, and also allows you to make a customized closing page. Also, if your website is SSL you will need a premium plan. The premium plan is very reasonably priced.
I am currently using their service on my websites.
There is actually a company in Israel that offers this as a service. Their website is here.
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
If you work with WordPress, you have a plugin for this.