JavaScript 页面切换后更改标题
JavaScript About 535 wordsJS 监听 visibilitychange 事件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>正在页面中</title>
</head>
<body>
</body>
<script type="text/javascript">
document.addEventListener('visibilitychange',function () {
if(document.visibilityState == 'hidden') {
normal_title = document.title;
document.title = "页面被切换了";
}else {
document.title = normal_title;
}
})
</script>
</html>
Views: 1,883 · Posted: 2019-04-08
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...