当前位置:网站首页>When leaving the web page, the website displays 404 Not found- starze V Club

When leaving the web page, the website displays 404 Not found- starze V Club

2022-06-11 00:00:00 Xingze V Club

reason

I came across a website today , When I left that website , The website immediately shows 404 Not Found, You scared me , I immediately went back to have a look , Results access to normal . Finally, carefully consider , Found that this is the use of js The effect of dynamic code implementation .

Implementation method

The implementation method is to add a paragraph js Code to dynamically monitor our operations , You only need the... Under the theme file header.php file , Just insert the following code before

<script type="text/javascript">
    
var OriginTitile = document.title;
var titleTime;
document.addEventListener('visibilitychange', function() {
    if (document.hidden) {
        document.title = ' Xingze V agency -404 Not Found';
        clearTimeout(titleTime);
    } else {
        document.title = '404? Never in my life 404 Of ';
        titleTime = setTimeout(function() {
            document.title = OriginTitile;
        }, 2000);
    }
});
</script>
原网站

版权声明
本文为[Xingze V Club]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020933399099.html