【问题标题】:Javascript URI decode not performing as expectedJavascript URI 解码未按预期执行
【发布时间】:2016-03-10 15:32:00
【问题描述】:

【问题讨论】:

    标签: javascript uri urldecode


    【解决方案1】:

    decodeURIComponent() 函数没有按照您期望的方式解码您的 URI,因为它实际上只适用于以前使用 encodeURIComponent() 编码的字符串。

    相反,您想使用decodeURI()。

    var url = 'https://external.xx.fbcdn.net/safe_image.php?d=AQB9-zMODCId1OZa&w=128&h=128&url=https%3A%2F%2Fscontent.xx.fbcdn.net%2Fhprofile-xpa1%2Fv%2Ft1.0-1%2Fp200x200%2F12289537_1025015047521253_6948708859100232371_n.png%3Foh%3Dd4b09489497f8705ca75467bd6af54e9%26oe%3D578DF677&upscale=1&ext=jpg';
    var decoded = decodeURI(url);
    document.write(decoded);

    【讨论】:

    • 感谢您的帮助
    猜你喜欢
    • 2018-12-23
    • 1970-01-01
    • 2019-05-23
    • 2013-08-20
    • 2017-12-15
    • 2011-02-25
    • 2012-11-23
    • 2014-10-20
    • 2015-09-17
    相关资源
    最近更新 更多