Ajax: simplify XHR detection.

Closes #1967
Merge remote-tracking branch 'origin/ajax-xhr' into ajax-xhr