[Solved] The invalidation of windows.location.txt on Android mobile phone

Problem: in the lower version of Android phones, the use of window.location.txt jump is invalid

solution 1:

Analysis: add a time stamp after the jump link. Considering that the cache problem may exist in the low version, we add a dynamic parameter time stamp after the jump link to refresh the cache data

// Add a timestamp after the jump link, because considering that it is a low version there may be caching problems so use the dynamic parameter timestamp after the jump link to refresh the cached data
window.location.href = url+'?time='+((new Date()).getTime());
solution 2:

Analysis: after using the above method, there will still be some problems with the jump of some models. Another method is tried to change the jump mode into asynchronous mode, and use a delayer to simulate (it is recommended that the time should be less than 300ms, otherwise users will be able to perceive some of the phenomenon of stuck)

// After using the above approach, there will still be some models have problems jumping, and tried another way to jump into an asynchronous way, using a time delay to simulate (recommended time less than 300ms, or the user will be able to perceive a slight lag phenomenon)
setTimeout(() => {
   window.location.href = url+'?time='+((new Date()).getTime());
}, 300);

Read More: