duandong1869 2010-11-01 16:04
浏览 53
已采纳

编码URL导致来自浏览器的禁止消息的奇怪问题

Get ready for some strangeness. The following works fine in Firefox:

Redirecting to this URL:

http://localhost/webs/van/front-end/slr/edit_rule.php?rule_name=test&rule_type=alloc_ext&copy=1

However, it does not work in IE8 since it converts the above to this, note the copyright symbol in the address at the end:

http://localhost/webs/van/front-end/slr/edit_rule.php?rule_name=test&rule_type=alloc_ext©=1

So, I thought weird, lets just encodeURIComponent to this:

window.location.href = 'edit_rule.php%3Frule_name%3Dtest%26rule_type%3Dalloc_ext%26copy%3D1';

BOTH, Firefox and IE8 now give me a Forbidden message!?!

You don't have permission to access /webs/van/front-end/slr/edit_rule.php? rule_name=test2&rule_type=alloc_ext&copy=1 on this server.

I don't understand, what is going on?

Thanks all for any help.

  • 写回答

2条回答 默认 最新

  • dongquanlin1885 2010-11-01 16:09
    关注

    & needs to be HTML encoded, not URI encoded. Specifically, replace them with &

    Technically, IE8's behavior is wrong, as &copy is missing the semicolon at the end to make it an HTML-encoded character.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法