【问题标题】:document.location.search.replace('?redirect=', '').replace('%2F', ''); is not working in Firefoxdocument.location.search.replace('?redirect=', '').replace('%2F', '');在 Firefox 中不起作用
【发布时间】:2018-11-15 08:06:31
【问题描述】:

文档位置搜索替换重定向到其他页面在 chrome 中工作,但

document.location.search.replace('?redirect=', '').replace('%2F', ''); 

在 Firefox 中不起作用,我看到重定向无限循环。

enter image description here

【问题讨论】:

  • 能否请您描述一下这篇文章的问题所在?
  • 当我们没有任何您正在使用的值的示例时,甚至很难猜测为什么某些浏览器不喜欢此代码的结果。考虑使用问题的minimal reproducible example 更新问题。

标签: javascript angular reactjs


【解决方案1】:

%2F 在 URL 中是“/”。

为什么不解码 URL?

或者你需要替换("\/","")

你可以试试吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-12
    • 1970-01-01
    • 2013-11-03
    • 2015-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多