前端开发H5消息推送

公司常用的前端开发软件
前端开发啥软件好用
手机开发前端的软件

html 代码

<!DOCTYPE html>
    <head>
        <meta charset=”utf-8″ />
        <meta
            name=”viewport”
            content=”initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width”
        />
        <title>消息推送</title>
        <!–[if lt IE 9]>
            <script src=”http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js”></script>
        <![endif]–>
        <script
            type=”text/javascript”
            src=”http://libs.baidu.com/jquery/2.0.0/jquery.min.js
        ></script>
    </head>
    <style>
        @charset “utf-8”;
        /* css Document */
        html {
            -webkit-text-size-adjust: 100%;
            -ms-text-size-adjust: 100%;
            font-size: 62.5%; /*10px*/
        }
        html * {
            tap-highlight-color: rgba(0, 0, 0, 0.05);
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
            -ms-tap-highlight-color: rgba(0, 0, 0, 0.05);
            margin: 0;
            padding: 0;
        }
        body {
            font-size: 1.4rem; /*14px*/
            font-family: ‘微软雅黑’;
        }
        a:link {
            color: #666;
        }
        a:visited {
            color: #666;
        }
        a:hover {
            color: #f00;
        }
        a:active {
            color: #f00;
        }
    </style>
    <body>
        <a
            href=”javascript:”
            onclick=”$.deskNotice(&quot;提示&quot;,&quot;您有一笔订单,请注意查看。&quot;)”
            >推送</a
        >
        <script type=”text/javascript”>
            $.extend({
                deskNotice: (function() {
                    requestPermission()
                    return function(msg, detail, icon) {
                        requestPermission()
                        if (
                            Notification &&
                            Notification.permission === ‘granted’
                        ) {
                            var notification = new Notification(msg, {
                                icon:
                                    icon ||
                                    ‘http://cdn.attach.qdfuns.com/notes/pics/201701/05/163634h3q669t7oko7dd8q.jpg’,
                                body: detail || ‘点击查看详情’,
                            })
                            // notification.onclick = function(){
                            // window.open( url || “http://baidu.com” );
                            // };
                        }
                    }
                    function requestPermission() {
                        !Notification &&
                            alert(
                                ‘你的浏览器不支持桌面提醒,请使用 Chrome 浏览器!’,
                            )
                        Notification &&
                            Notification.permission !== ‘granted’ &&
                            Notification.requestPermission()
                    }
                })(),
            })
        </script>
    </body>
</html>
软件开发前端知识视频
web前端开发的软件
软件开发的前端和后端
» 本文来自:前端开发者 » 《前端开发H5消息推送》
» 本文链接地址:https://www.rokub.com/6925.html
» 您也可以订阅本站:https://www.rokub.com
赞(0)
64K

评论 抢沙发

评论前必须登录!