Does Android support [removed].replace or any equivalent?

后端 未结 4 769
清歌不尽
清歌不尽 2020-12-06 15:16

It seems that the Android browser doesn\'t properly implement window.location.replace.

In most browsers, calling window.location.replace wi

4条回答
  •  猫巷女王i
    2020-12-06 16:09

    You can try using the replaceState method on the history window.history

          if (((navigator.userAgent.toLowerCase().indexOf('mozilla/5.0') > -1 && navigator.userAgent.toLowerCase().indexOf('android ') > -1 && navigator.userAgent.toLowerCase().indexOf('applewebkit') > -1) && !(navigator.userAgent.toLowerCase().indexOf('chrome') > -1))) {
              window.history.replaceState({}, document.title, base + fragment);
          } else {
              location.replace(base + fragment);
          }
    

提交回复
热议问题