Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Synchronous XMLHttpRequest deprecated Date: Mon, 06 Apr 2015 15:36:23 +0200 Organization: PointedEars Software (PES) Lines: 23 Message-ID: <1787376.QsvDXBBI4c@PointedEars.de> References: <5521ac06$0$2891$e4fe514c@news2.news.xs4all.nl> <3049656.CVpVeAz9R9@PointedEars.de> <060420151323054349%timstreater@greenbee.net> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1428327507 24930 eJwFwQcBwEAIBDBLzy5yWOdfQhMTJ59QN1eD4UVsLqhpKDtt++UVGJTCvIrixdGkfH619wMoyxH2 (6 Apr 2015 13:38:27 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Mon, 6 Apr 2015 13:38:27 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwYEBwCAIA7CXhAHVc9CW/09Ykl9ZPURlRU7OEHF69nY3wrRKQYGgbjmmEIKVsX01RnwmZ8dBNnTXD2TGFi8= Cancel-Lock: sha1:+tckkls/hzT8UGFiIpCrJNSXQEU= X-NNTP-Posting-Host: eJwFwQkBwDAIA0BN0CRQOR2Pfwm745GpAqLA5Y7qzeNmscdNztGknZceF0i0+h7f24ZvED8pfxEZ Xref: csiph.com comp.lang.javascript:27206 Tim Streater wrote: > […] Thomas 'PointedEars' Lahn […] wrote: >> I do not see your point. Why exactly can that not be done in a user- >> friendly, non-blocking, asychronous way? > > Termination actions. If the user closes the window in my app, the > unbeforeunload handler runs. This is my last chance to tidy up, and I > need to be able to run a PHP script and, crucially, to have it > complete, before the handler exits. > > Making an async XMLHttpRequest will mean that the handler will complete > right away and my PHP script will be aborted by apache. So I make a > sync request and all behaves as required. Your application is badly designed if it relies on a “beforeunload” event listener triggering a synchronously-handled HTTP request. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.