为一些奇怪的事情做好准备。以下在 Firefox 中运行良好:
重定向到这个 URL:
http://localhost/webs/van/front-end/slr/edit_rule.php?rule_name=test&rule_type=alloc_ext©=1
但是,它在 IE8 中不起作用,因为它将上面的转换为这个,请注意末尾地址中的版权符号:
http://localhost/webs/van/front-end/slr/edit_rule.php?rule_name=test&rule_type=alloc_ext©=1
所以,我觉得很奇怪,让 encodeURIComponent
这样做:
window.location.href = 'edit_rule.php%3Frule_name%3Dtest%26rule_type%3Dalloc_ext%26copy%3D1';
Firefox 和 IE8 现在都给我一条禁止消息!?!
You don't have permission to access /webs/van/front-end/slr/edit_rule.php? rule_name=test2&rule_type=alloc_ext©=1 on this server.
我不明白,这是怎么回事?
感谢大家的帮助。
最佳答案
&
需要是 HTML encoded , 不是 URI 编码。具体来说,将它们替换为 &
从技术上讲,IE8 的行为是错误的,因为 ©
末尾缺少分号以使其成为 HTML 编码字符。
关于php - 编码 URL 导致来自浏览器的禁止消息的奇怪问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4070643/