Skip to content Skip to sidebar Skip to footer

Making Get Request For Same Domain Giving Cors Error

In a browser extension, this my ajax call var xhr = new XMLHttpRequest(); xhr.open('GET', window.location.href, true); xhr.responseType = 'arraybuffer'; xhr.onload = function(even

Solution 1:

You can use a web service such as CrossOrigin.me to get ahead of it. I used a code like this and it did work for me:

$.ajax({
  url: 'https://crossorigin.me/http://people.cs.aau.dk/~torp/Teaching/E01/Oop/handouts/collections.pdf',
  jsonpCallback: 'callback',
  type: 'GET',
  success: function (data) {
    console.log(data);
  }
});

Fiddle: http://jsfiddle.net/L84u10yj/

I was able to make it working here:

Preview

Post a Comment for "Making Get Request For Same Domain Giving Cors Error"