27 lines
514 B
JavaScript
27 lines
514 B
JavaScript
/**
|
|
* Expose `use_jsonp`
|
|
*/
|
|
|
|
module.exports = use_jsonp;
|
|
|
|
/**
|
|
* Return true if `jsonp` is required
|
|
*
|
|
* @return {Boolean}
|
|
* @public
|
|
*/
|
|
|
|
function use_jsonp() {
|
|
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : null;
|
|
|
|
if (xhr && 'withCredentials' in xhr) {
|
|
return false;
|
|
}
|
|
|
|
// We no longer support XDomainRequest for IE8 and IE9 for CORS because it has many quirks.
|
|
// if ('XDomainRequest' in window && window.location.protocol === 'https:') {
|
|
// return false;
|
|
// }
|
|
|
|
return true;
|
|
} |