admin管理员组文章数量:1334704
Doing tests locally on my puter:
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?
Doing tests locally on my puter:
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?
- look here if can help you: stackoverflow./questions/17340482/… – TotPeRo Commented Feb 14, 2015 at 20:09
- could you specify details of your xhr? – YakovL Commented Mar 24, 2016 at 10:35
2 Answers
Reset to default 2You are encountering a same-origin-policy issue (see http://en.wikipedia/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 overe this by adding headers to your server side code:
Access-Control-Request-Headers
Access-Control-Request-Method
See: https://developer.mozilla/en-US/docs/Web/HTTP/Access_control_CORS
I have resolve NS_ERROR_DOM_BAD_URI error in my project (using ReactJS - handle API by axios) but I think my explaination an solution can help you:
- How did I get this error:
FE code:
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json'
}
BE code (Spring Boot):
allowedHeaders("userLoginToken", "Content-Type")
Because I only allow 'Content-Type' in headers, but my header have redundant config 'Access-Control-Allow-Origin' and my BE not allow that.
How did I resolve: Only delete 'Access-Control-Allow-Origin' in request headers and error was disappeared.
headers: { 'Content-Type': 'application/json' }
本文标签: javascripti18n NSERRORDOMBADURI Access to restricted URI deniedStack Overflow
版权声明:本文标题:javascript - i18n: NS_ERROR_DOM_BAD_URI: Access to restricted URI denied - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742341346a2456664.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论