1 bootstrap.inc backdrop_is_html()

Detects if this is an HTML HTTP request.

This liberal detection considers all requests that lack an Accept header or X-Requested-With (as set by jQuery and other JavaScript libraries) to be an HTML request. Any other types of requests must specify X-Requested-With in order to be returned in an alternative format.

File

core/includes/bootstrap.inc, line 4169
Functions that need to be loaded on every Backdrop request.

Code

function backdrop_is_html() {
  return empty($_SERVER['HTTP_ACCEPT']) || strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === 0 || empty($_SERVER['HTTP_X_REQUESTED_WITH']);
}