【技术分享】QQ里提示使用浏览器打开网站代码


推荐

QQ里打开网站的时候,不会直接打开,而是提示使用浏览器打开,很多人可能需要或想要!
直接把以下代码加上head或者footer即可。

<?php if ((strpos($_SERVER['HTTP_USER_AGENT'], 'QQ/') || strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false)) : ?>
    <?php $siteurl = ($_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>
        <meta charset="UTF-8">
        <title>使用浏览器打开</title>
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
        <style>
            body,html{width:100%;height:100%}*{margin:0;padding:0}body{background-color:#fff}.top-bar-guidance{font-size:15px;color:#fff;height:70%;line-height:1.8;padding-left:20px;padding-top:20px;background:url(//cdn.jsdelivr.net/gh/HaoOuBa/BlogStatic/usr/uploads/2021/05/4203917515.png) center top/contain no-repeat}.top-bar-guidance .icon-safari{width:25px;height:25px;vertical-align:middle;margin:0 .2em}.app-download-btn{display:block;width:214px;height:40px;line-height:40px;margin:18px auto 0 auto;text-align:center;font-size:18px;color:#2466f4;border-radius:20px;border:.5px #2466f4 solid;text-decoration:none}
        </style>
    </head>
    <body>
        <div class="top-bar-guidance">
            <p>点击右上角<img src="//cdn.jsdelivr.net/gh/HaoOuBa/BlogStatic/usr/uploads/2021/05/183124684.png" class="icon-safari"> <span id="openm">Safari打开</span></p>
            <p>可以继续浏览本站哦~</p>
        </div>
        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js"></script>
        <a data-clipboard-text="<?php echo $siteurl; ?>" class="app-download-btn">点此复制本站网址</a>
        <script type="text/javascript">
            new ClipboardJS(".app-download-btn");
            document.querySelector(".app-download-btn").onclick = function () {
                alert("复制成功!")
            }
        </script>
    </body>
    </html>
    <?php exit; ?>
<?php endif; ?>

 

© 版权声明
THE END
感谢支持啦!୧( ⁼̴̶̤̀ω⁼̴̶̤́ )૭
点赞9 分享
快来说两句( ˃̶̤́ ꒳ ˂̶̤̀ ) 抢沙发
头像
畅所欲言吧༼。^・ェ・^。༽,水回复不给过哦(纯数字和字母)
提交
头像

昵称

夸夸Ta
夸夸
还有吗!没看够!
取消
昵称表情代码图片

    暂无评论内容