首页 > 解决方案 > encodeURIComponent() 在 IE-11-Js/ReactJs 中不起作用

问题描述

我想使用如下上下文历史记录点击报告时访问 url:

function onClick() {
   let name = encodeURIComponent(title); // title is string- ex: "abc", "test", "user123"
      this.context.history.push({
        pathname: `/report?name="${name}"`
      });
}

这在 Chrome,FF 中运行良好,但在 IE 上给出 404。知道如何解决这个问题吗?

标签: javascriptreactjs

解决方案


推荐阅读