Take the 2-minute tour ×

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.

share|improve this question
Why? For those who are machmir like R' Heinemann's opinion before he retracted it? mi.yodeya.com/questions/2671/is-it-a-malacha/2673#2673 –  Shalom Sep 3 '10 at 13:06
I wasn't really asking about whether or not this precaution is required, since clearly there are many different types of websites for which the answer may be different. But for what it's worth, I have in mind a private website where my family members can collaborate on compiling genealogical data. Since most of my family is Jewish, and many are not Sabbath observant, this seems like it might be a reasonable precaution to take. And the chance that people may be incorrectly blocked is not the greatest concern, altough I would certainly prefer to avoid it. –  Sam Sep 3 '10 at 21:19
By the way, perhaps the title of the question linked to by Shalom should be made more descriptive, since I searched for a question like this before posting and didn't find this. –  Sam Sep 3 '10 at 21:20
@Sam - Done. (By the way, if you're on the US East Coast as I post this, mi.yodeya recommends that you shut down your comuputer right now.) –  Isaac Moses Sep 3 '10 at 23:24
So what's wrong with warning your family? If they continue anyway it's their problem... –  yydl Sep 5 '10 at 1:25

7 Answers 7

[edited to reflect recent experiences as well as newfound technical knowledge]

Fair Warning

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...

Technical Implementation

With the fair warning in mind, it's hard to give a one-size fits all approach. Essentially there are three problems:

  1. Users live in different places: Shabbos starts at different times
  2. Users live in different timezones
  3. 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.

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 Line

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]

share|improve this answer
In theory, a "continue at your own risk" button could mean some people now will do one extra click to view your website. But I don't think that's a problem. (There are rabbis who have given a lost driver exact directions on Shabbos, "so he doesn't drive around any extra.") –  Shalom Sep 3 '10 at 14:48
Well yeah. But imagine if you incorrectly identify someone as in Shabbos. Aside for being really angry at you for misjudging, he will also lose all the content on your site, because it's incorrectly inaccessible. On the other hand, by telling him that it's Shabbos where it really is Shabbos, you are also helping him out. I.e. a win-win situation. –  yydl Sep 3 '10 at 14:58
They should change their system clock then... How hard is that really? –  Moshe Sep 5 '10 at 3:29
Well changing system clock is annoying: a) if you don't have admin rights b) it can mess up certain programs and authentication systems on your computer c) it messes with your brain if you want to know the time. Besides, if you're using my method, it has nothing to do with their system clock, it's server side –  yydl Sep 5 '10 at 4:13

There is actually a company in Israel that offers this as a service. Their website is here.

share|improve this answer
Besides for the fact that they used an unconventional spelling of "Shabbos", the price is outrageous. Any web developer with half-baked skills should be able to throw together a script to do that. And, for the record, they use user-location, like I suggested. –  Moshe Sep 5 '10 at 3:28
You beat me to it Dave. –  Rabbi Michael Tzadok Sep 6 '10 at 0:39

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.

share|improve this answer
Yes, but that means redirecting based on Javascript. Not quite elegant, and definitely not server-side. Remember, the point here is to provide an alternate page, not to redirect after-the-fact. –  yydl Sep 3 '10 at 15:35
Once one types a URL, redirect or not, the melacha has been done. And, you can use AJAX to replace content, no visible redirect there ;) –  Moshe Sep 5 '10 at 3:25
The point here is for more melacha, i.e. after the first hit. By your method, the redirect would happen sometime after the page loads. It makes a lot more sense to do it on the server side, so that the user is immediately taken to the correct destination. This is all for the technical side of the implementation; nothing to do with Halacha –  yydl Sep 5 '10 at 4:16
So, who is doing Melacha? An Intel chip in Arizona? Please. Once the user hits enter, they wait for a webpage to show up and stop loading. Users are tuned in to browser behavior and would see the page redirecting. Odds are they would wait for the load to finish. –  Moshe Sep 5 '10 at 8:00
As I said, nothing to do with Halacha. Let's keep it to the aesthetics: User sees page starts loading with real content... Freeze, uh oh! Hey where'd the page go?? Oh my what's this? It's just not real. True. proper redirection doesn't give a sneak preview. –  yydl Sep 7 '10 at 5:00

Drupal plug-in exists here: http://drupal.org/project/shabbat

share|improve this answer

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.

share|improve this answer



share|improve this answer
Domain is no longer active –  user4523 Nov 28 at 8:34

If you work with WordPress, you have a plugin for this.

share|improve this answer
Welcome to Mi Yodeya, drmosko, and thanks for the info! I hope you stick around and enjoy the site, including its 182 other questions about the Internet. –  msh210 Nov 28 at 6:46

Your Answer


