Home >Web Front-end >JS Tutorial >ios return does not automatically refresh the page problem

ios return does not automatically refresh the page problem

巴扎黑
巴扎黑Original
2017-07-22 15:21:582058browse

In the actual development process, there are big pitfalls in the compatibility of mobile terminals. Android is OK, but ios is not, and ios is OK, and Android is invalid. In this way, the rollback operation of ios will not automatically refresh the page, which is very annoying. !
The common history.back() history.go(-1) are not effective in the ios system.
If you want to achieve the effect of real-time refresh, you only need to add the following js to the page you want to refresh:

$(function () {
var isPageHide = false;
window.addEventListener('pageshow', function () {
if (isPageHide) {
window.location.reload();
}
});
window.addEventListener('pagehide ', function () {
isPageHide = true;
});
})

The above is the detailed content of ios return does not automatically refresh the page problem. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn