带有正斜杠的哈希片段在 IE 中使用 AJAX 请求抛出 403 错误 [英] Hash fragments with forward-slash throwing 403 errors with AJAX requests in IE
问题描述
我的网址类似于:http://www.example.com/#!/test/
以及当哈希片段为 /test/
时处理的 AJAX 请求.AJAX 请求很好,除了在 IE 中,它会抛出 403 错误.它在所有其他浏览器中都可以正常工作.
And an AJAX request that is handled when the hash fragment is /test/
.
The AJAX request is fine except in IE, where it throws a 403 error. It works fine in all other browsers.
现在,如果我将 URL 更改为:http://www.example.com/#!test/
Now, if I change the URL to: http://www.example.com/#!test/
它工作得很好.我无法更改我当前的哈希片段 URL 结构.任何解决方案/建议?
It works just fine. I can't change my current hash fragment URL structure. Any solutions/suggestions?
推荐答案
使用网络调试器(例如 www.fiddler2.com)并确定 HTTP 请求中的哪些差异导致服务器发回不同的响应.我的猜测是,您从散列中获取数据的方式会导致在浏览器之间向服务器发送不同的查询(例如,包含#"或缺少#")并导致服务器将 403 返回到浏览器.
Use a network debugger (e.g. www.fiddler2.com) and determine what the difference in the HTTP request is that results in the server sending back a different response. My guess is that the way that you're getting the data out of the hash results in sending a different query to the server between browsers (e.g. includes "#" or lacks "#") and that causes the server to return the 403 to IE.
这篇关于带有正斜杠的哈希片段在 IE 中使用 AJAX 请求抛出 403 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!