Guest User

Untitled

a guest
Apr 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. if ('withCredentials' in new XMLHttpRequest()) {
  2. /* supports cross-domain requests */
  3. }
  4.  
  5. //Detect browser support for CORS
  6. if ('withCredentials' in new XMLHttpRequest()) {
  7. /* supports cross-domain requests */
  8. document.write("CORS supported (XHR)");
  9. }
  10. else if(typeof XDomainRequest !== "undefined"){
  11. //Use IE-specific "CORS" code with XDR
  12. document.write("CORS supported (XDR)");
  13. }else{
  14. //Time to retreat with a fallback or polyfill
  15. document.write("No CORS Support!");
  16. }
Add Comment
Please, Sign In to add comment