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.
-
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– ShalomCommented Sep 3, 2010 at 13:06
-
2I 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.– SamCommented Sep 3, 2010 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.– SamCommented Sep 3, 2010 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 ♦Commented Sep 3, 2010 at 23:24
-
1So what's wrong with warning your family? If they continue anyway it's their problem...– yydlCommented Sep 5, 2010 at 1:25
7 Answers
[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:
- 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.
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]
-
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.")– ShalomCommented Sep 3, 2010 at 14:48
-
2Well 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.– yydlCommented Sep 3, 2010 at 14:58
-
They should change their system clock then... How hard is that really?– MosheCommented Sep 5, 2010 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– yydlCommented Sep 5, 2010 at 4:13
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.
-
1Besides 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.– MosheCommented Sep 5, 2010 at 3:28
-
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.
-
1Yes, 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.– yydlCommented Sep 3, 2010 at 15:35
-
1Once one types a URL, redirect or not, the melacha has been done. And, you can use AJAX to replace content, no visible redirect there ;)– MosheCommented Sep 5, 2010 at 3:25
-
1The 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– yydlCommented Sep 5, 2010 at 4:16
-
2So, 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.– MosheCommented Sep 5, 2010 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.– yydlCommented Sep 7, 2010 at 5:00
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)
-
1Domain is no longer active– user4523Commented Nov 28, 2014 at 8:34
If you work with WordPress, you have a plugin for this.
-
1Welcome 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 ♦Commented Nov 28, 2014 at 6:46