Work leak filled

I encountered long before micro-channel browser pit, and today they met, record it:

window.location.reload () micro-channel browser Failure

href attribute is a location object, reload () method of the object location is
so for href, the new URL can property for the browser to read and display the contents of the new URL.
For reload () is to reload the current document, if the method does not require parameters or parameter is false, it will use the HTTP If-Modified-Since header to detect whether the document has changed on the server. If the document has changed, reload () will download the document again. If the document is not changed, the method to load the document from the cache. This effect and the user clicks the browser's Refresh button is exactly the same. If the method parameter is set to true, then no matter what the last modified date of the document is that it will bypass the cache, re-download the file from the server. This user hold down Shift and click the Refresh button in the browser when the effect is exactly the same.

But for the Android phone micro letter of the browser, reload just load the document from the cache, so when you use this method, is invalid;

We need to add a timestamp or a random number, a micro-channel software buffer distinction

Solution, replacing window.location.reload () with the following code

 window.location.href = location.href+'&time='+((new Date()).getTime());

  

Guess you like

Origin www.cnblogs.com/elementzhao/p/11344154.html