i18n: NS_ERROR_DOM_BAD_URI: Access to restricted URI denied

余生颓废 提交于 2019-12-08 11:21:18

问题


Doing tests locally on my computer:

index.hml

<!DOCTYPE html>
<html>
    <head>
        <!--script src="angular.js"></script-->
        <script src="i18next.js"></script>
        <script src="app.js"></script>
    </head>
    <body>
    </body>
</html>

app.js

i18n.init();

Error @ line 672 in i18next.js

xhr.send(payload);

NS_ERROR_DOM_BAD_URI: Access to restricted URI denied

  • How do I solve this error?
  • Optional: What does this line do?

回答1:


You are encountering a same-origin-policy issue (see http://en.wikipedia.org/wiki/Same-origin_policy). This means that either the port, domain, or protocol is not the same between the URI that you are sending a request TO and the URL that you are sending the request FROM.

You can overcome this by adding headers to your server side code:
Access-Control-Request-Headers
Access-Control-Request-Method

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS



来源:https://stackoverflow.com/questions/27186036/i18n-ns-error-dom-bad-uri-access-to-restricted-uri-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!