From: Brion Vibber Date: Wed, 27 Dec 2006 05:50:07 +0000 (+0000) Subject: Add a warning for Firefox 2.0 which rejects XMLHttpRequest to localhost... X-Git-Tag: 1.31.0-rc.0~54755 X-Git-Url: http://git.cyclocoop.org/%22.%20generer_url_ecrire%28%22sites_tous%22%2C%22%22%29.%20%22?a=commitdiff_plain;h=bd02ae1dffd02b7e6e1e7744cb37d73e698ff351;p=lhc%2Fweb%2Fwiklou.git Add a warning for Firefox 2.0 which rejects XMLHttpRequest to localhost... Safari unfortunately seems to let you submit but doesn't actually _work_ on localhost. Doesn't throw an exception here, just never sends a response... --- diff --git a/skins/common/ajax.js b/skins/common/ajax.js index ebc4fd6039..4006559361 100644 --- a/skins/common/ajax.js +++ b/skins/common/ajax.js @@ -96,7 +96,14 @@ function sajax_do_call(func_name, args, target) { return false; } - x.open(sajax_request_type, uri, true); + try { + x.open(sajax_request_type, uri, true); + } catch (e) { + if (window.location.hostname == "localhost") { + alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing."); + } + throw e; + } if (sajax_request_type == "POST") { x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");