A
A
ArtyukhAlex2015-06-05 18:51:11
JavaScript
ArtyukhAlex, 2015-06-05 18:51:11

Ajax request in opencart on cyrillic domain in firefox?

Faced the problem only in firefox.
When I try to execute ajax, I get errors:

Запрос из постороннего источника заблокирован: Политика одного источника запрещает чтение удаленного ресурса на http://мойдомен.рф/index.php?route=checkout/cart/add. (Причина: отсутствует заголовок CORS 'Access-Control-Allow-Origin').


and

Запрос из постороннего источника заблокирован: Политика одного источника запрещает чтение удаленного ресурса на http://мойдомен.рф/index.php?route=checkout/cart/add. (Причина: не удалось выполнить запрос CORS).


Relative link request URL:

$.ajax({
  url: 'index.php?route=checkout/cart/add',
  type: 'post',
  data: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
  dataType: 'json',
/* код */

});


moreover, if the url is written via http

$.ajax({
  url: 'http://мойдомен.рф/index.php?route=checkout/cart/add',
  type: 'post',
  data: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
  dataType: 'json',
/* код */

});


then on Firefox the request is processed perfectly,

in the configs the url is registered through the punycode.
As http://xn--d1acklchcc.xn--p1ai/

I see the problem:
Firefox converts the domain to punycode, then compares it with the Cyrillic domain, considers that the request is cross-domain and blocks it.

Please help me how to cure.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2015-06-05
@ArtyukhAlex

here
UPD1: forum

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question