File: index.js

package info (click to toggle)
node-has-cors 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 96 kB
  • ctags: 1
  • sloc: makefile: 14; sh: 2
file content (17 lines) | stat: -rw-r--r-- 396 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

/**
 * Module exports.
 *
 * Logic borrowed from Modernizr:
 *
 *   - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
 */

try {
  module.exports = typeof XMLHttpRequest !== 'undefined' &&
    'withCredentials' in new XMLHttpRequest();
} catch (err) {
  // if XMLHttp support is disabled in IE then it will throw
  // when trying to create
  module.exports = false;
}