There is no reliable method to tell them apart; browsers use almost the same HTTP code for XMLHttpRequest and regular access.
When using different browsers for custom headers and potential interference with a proxy server, I would not trust the X-Requested-With header to gain access in all cases. (And what all isXmlHttpRequest are actually looking for.)
Instead, I would use a parameter (? Ajax = 1) or another method that generates a unique URL, such as a smack clause.
bobince
source share