12
									
								
								packages/websocket/src/engine.io-client/contrib/has-cors.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								packages/websocket/src/engine.io-client/contrib/has-cors.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
// imported from https://github.com/component/has-cors
 | 
			
		||||
let value = false;
 | 
			
		||||
 | 
			
		||||
try {
 | 
			
		||||
    value = typeof XMLHttpRequest !== 'undefined' &&
 | 
			
		||||
        'withCredentials' in new XMLHttpRequest();
 | 
			
		||||
} catch (err) {
 | 
			
		||||
    // if XMLHttp support is disabled in IE then it will throw
 | 
			
		||||
    // when trying to create
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const hasCORS = value;
 | 
			
		||||
		Reference in New Issue
	
	Block a user