【发布时间】:2015-11-30 21:08:34
【问题描述】:
我有一个响应式 Web 应用程序,并希望当应用程序在移动浏览器中运行时在移动设备的状态栏中显示通知。 谷歌搜索后我能找到的最好的是:status-bar-notification
我无法理解这将如何帮助显示通知。 与上述链接中的问题类似,我想在点击时显示通知。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body>
<input type="button" value="Notiiiiiiif" id="btNotif"/>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
btNotif = document.getElementById('btNotif');
btNotif.addEventListener('click', function(){
//There I want a notification to appear in the mobile status bar
});
</script>
</body>
</html>
有什么办法可以做到吗?
【问题讨论】:
-
最近遇到:
-
developers.google.com/web/progressive-web-apps .....看起来很有希望实现同样的目标
标签: javascript android html cordova notifications