0

Developing a program for Angular 1.5.8

The same function is triggered when the page is loaded and pasted from the clipboard, and for some reason, when loading all goes normally, but when you paste from the clipboard in windows 10 in IE (other browsers works) at the start of the function XMLHttpRequest xhr.open ('put', 'http://localhost:62631/api/PlantConsignee/', true); I give error "invalid argument." And when i make angular wrap, i take error "Access denied" PlantConsignee.query ( Error: access Denied.

at Anonymous function (http://localhost:62631/prodaction/script/node_modules Oh.min.js?ver=0.6.6688.17819:125:278) at n (http://localhost:62631/prodaction/script/node_modules Oh.min.js?ver=0.6.6688.17819:122:53) at Anonymous function (http://localhost:62631/prodaction/script/node_modules Oh.min.js?ver=0.6.6688.17819:119:255) at Anonymous function (http://localhost:62631/prodaction/script/node_modules Oh.min.js?ver=0.6.6688.17819:154: 10) at m.prototype.$eval (http://localhost:62631/prodaction/script/node_modules.min.js?ver=0.6.6688.17819:168: 336) at m.prototype.$digest http://localhost:62631/prodaction/script/node_modules Oh.min.js?ver=0.6.6688.17819:165: 412) at m.prototype.$apply (http://localhost:62631/prodaction/script/node_modules.min.js?ver=0.6.6688.17819:169: 111) at Anonymous function (http://localhost:62631/prodaction/script/node_modules Oh.min.js?ver=0.6.6688.17819:299: 245) at w.event.dispatch (http://localhost:62631/prodaction/script/node_modules.min.js?ver=0.6.6688.17819:2: 41706) at y.handle (http://localhost:62631/prodaction/script/node_modules Oh.min.js?ver=0.6.6688.17819:2:39718)

function planttetst() {

      console.log("Запрос заводов");
      var xhr = new XMLHttpRequest();
      xhr.open('put', 'http://localhost:62631/api/PlantConsignee/', true);
      xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
      var inp = JSON.stringify({ "pageNumber": 1, "pageSize": 9999, "Count": 9999, "Items": [{ "Id": 1, "PlantCode": "**", "Code": "BP00016238" }] });
      xhr.send(inp);
      xhr.onreadystatechange = function () {
          var response = xhr.responseText;
          console.log("ответ заводов" + response.toString());
      }

      PlantConsignee.query({ "pageNumber": 1, "pageSize": 9999, "Count": 9999, "Items": [{ "Id": 1, "PlantCode": "**", "Code": "BP00016238" }] }).$promise.then(function (response) {
        console.log("Запрос заводов мал" + (new Date).toString());
        alert("super");
      }).catch(function (reason) {
        notifyService.error("Ошибка при загрузке справочника завод planttetst1" + ((reason === undefined || reason === null || reason.data === undefined) ? "" : reason.data.message) + ". Повторите попытку через 5 минут");
      });

        }
I gave full administrative rights to this site, added to a zone of a local intranet, doesn't help, it even locally doesn't start this reference. Tried to downgrade angular didn't help. Tried to Increase version angular. I get only up to 1.5.9, then the paths are broken and in General the app is not available becomes.

And the main thing, this error occurs only in IE, in chrome everything is available:/

katerinkadar
  • 25
  • 1
  • 8
  • angular.module('publicApp').factory('Document', function ($resource) { return.factory('PlantConsignee', function ($resource) { return $resource('api/PlantConsignee/:id', {}, { query: { method: 'PUT', url: 'api/PlantConsignee/Put' } }); }) – katerinkadar May 15 '18 at 08:49

1 Answers1

0

I solved this problem by using a setTimeout() on the original AJAX call. E.g:

setTimeout(function() {
    XMLHttpRequest xhr.open('put', 'http://localhost:62631/api/PlantConsignee/', true);
}, 1);

I'm assuming it's some kind of bug in IE. Just 1 millisecond was all it needed!

Very help this question IE 11 error - Access is denied - XMLHttpRequest

katerinkadar
  • 25
  • 1
  • 8