Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularJS Firefox编码URL_Javascript_Angularjs_Firefox_Urlencode - Fatal编程技术网

Javascript AngularJS Firefox编码URL

Javascript AngularJS Firefox编码URL,javascript,angularjs,firefox,urlencode,Javascript,Angularjs,Firefox,Urlencode,我在Angular上使用Firefox时遇到了一个奇怪的问题,我不知道如何解决这个问题,也不知道需要研究什么才能找到解决方案 Firefox中的所有URL如下所示: http://www.domain.com/#somehash|%2FMerchant%2Fmerchant.com http://www.domain.com/#somehash|/Merchant/merchant.com Chrome中的相同URL如下所示: http://www.domain.com/#somehash|

我在Angular上使用Firefox时遇到了一个奇怪的问题,我不知道如何解决这个问题,也不知道需要研究什么才能找到解决方案 Firefox中的所有URL如下所示:

http://www.domain.com/#somehash|%2FMerchant%2Fmerchant.com
http://www.domain.com/#somehash|/Merchant/merchant.com
Chrome中的相同URL如下所示:

http://www.domain.com/#somehash|%2FMerchant%2Fmerchant.com
http://www.domain.com/#somehash|/Merchant/merchant.com
这在Firefox中被证明是有问题的,因为我们正在对URL进行一些条件检查,这导致Firefox的一些if条件由于编码而失败

提前感谢。

您可以使用decodeURIComponent对url进行解码

decodeURIComponent('http://www.domain.com/#somehash|%2FMerchant%2Fmerchant.com')
=> "http://www.domain.com/#somehash|/Merchant/merchant.com"
请记住,结果可能不是有效的URL

有关详细信息:


这是可能的,但是我想知道为什么不同浏览器之间的行为不一致显示您是否获得URL?document.URL应在不同浏览器之间保持一致