encodeURI會忽略host部分和url合法字符如/#.,encodeURIComponent則全部編碼。
var url = "/a/a.b /c?ss=2&b=0#ss%s";
encodeURI = /a/a.b%20/c?ss=2&b=0#ss%25s (編碼了空格和%)
encodeURIComponent = %2Fa%2Fa.b%20%2Fc%3Fss%3D2%26b%3D0%23ss%25s (除了“點”全部編碼)
參考:
http:///tool/urldecode.htm