<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中工作正常吗?