0
<script>
    function test ()
    {
        var s = encodeURIComponent('a b');
        alert(s);   
        window.location.href = 'http://example.com/?' + s;
    }   
    test();     
</script>

显示alert()它已正确编码,但地址栏显示此http://example.com/?a b

在此处输入图像描述

注意:我在 Chrome 和 Safari 中测试工作正常,但在 Firefox 中不行?

4

0 回答 0