1. 程式人生 > >修改title和icon小圖片

修改title和icon小圖片

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>
            我是之前的,1秒後被替換(適用於手機和pc)
        </title>
        <link rel="shortcut icon" href="snipaste_20170824_145806.png" type="image/x-icon" />  <!-- 修改小圖示 -->
    </head>
    <body>
        <script type="text/javascript">
            document.setTitle = function(t) {
                document.title = t;
                var i = document.createElement('iframe');
                i.src = '//m.baidu.com/favicon.ico';
                i.style.display = 'none';
                i.onload = function() {
                  setTimeout(function(){
                    i.remove();
                  }, 9)
                }
                document.body.appendChild(i);
            }
            setTimeout(function(){
                document.setTitle('我是被替換後內容')
            }, 1000)
        </script>
    </body>
</html>