Javascript AngularJS Firefox编码URL
我在Angular上使用Firefox时遇到了一个奇怪的问题,我不知道如何解决这个问题,也不知道需要研究什么才能找到解决方案 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|
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应在不同浏览器之间保持一致