This repository has been archived by the owner on Oct 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
/
index.html
103 lines (93 loc) · 6.23 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>HTML5 Web Notifications demo by Danger Cove</title>
<meta name="description" content="This tiny website demonstrates the use of HTML5 notifications.">
<meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Crimson+Text">
<link rel="stylesheet" href="css/style.css">
<script src="js/libs/modernizr-2.5.0.min.js"></script>
</head>
<body>
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
<a href="https://github.com/DangerCove/html5-notifications"><img style="position: absolute; top: 0; right: 0; border: 0;" src="img/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
<header class="container">
<h1>HTML5 Web Notifications</h1>
<p>Read <a href="http://dangercove.com/blog">the journal</a> or <a href="https://twitter.com/dangercove" class="twitter-follow-button" data-show-count="false">Follow @dangercove</a> for similar experiments.</p>
</header>
<div id="content" role="main" class="container">
<div id="not_supported">
<h2>Not supported</h2>
<p>Sorry, to keep it simple and prevent exceptions, this demonstration uses the vendor-specific <code>window.webkitNotifications</code>, which of all the Webkit-browsers is currently only supported by Google Chrome.</p>
<p>For information on the use of <code>window.mozNotifications</code>, check <a href="https://wiki.mozilla.org/Services/Notifications/Push/API" target="_blank">Mozilla's wiki</a>. It's very similar to Webkit's implementation, but lacks HTML notifications.</p>
</div>
<div id="blocked">
<h2>Blocked</h2>
<p>Sorry, you've blocked notifications for this page. Copy the url below to your address bar, remove the block and try again :).</p>
<input type="text" value="chrome://settings/contentExceptions#notifications">
</div>
<div id="supported">
<section class="needs_support inactive">
<h2>Request permission</h2>
<p>Notifications are different from regular pop-ups in that they require the user's permission to be shown.</p>
<p>Notice that the request permission dialog only shows after user interaction (e.g. clicking a button). If you're adding this to a Chrome Extension, just add the 'notifications' permission and you're all set.</p>
<input id="ask_permission" type="button" value="Ask permission to display notifications">
</section>
<section class="needs_permission inactive">
<h2>Show notification</h2>
<p>HTML5 Notifications come in two flavors: plain text and HTML. Plain text allows you to customize a couple of parameters, HTML shows any .html file you want as a notification.</p>
<p>The examples below are very simple. I didn't even add a timeout to make them disappear after a set amount of time (which you probably should).</p>
<div class="notification_forms clearfix">
<div id="plain_notification">
<h3>Plain text</h3>
<form id="plain_form" action="#" method="post">
<fieldset>
<label for="plain_icon">Icon/URL (32x32):</label>
<input id="plain_icon" name="plain_icon" type="text" value="img/icon.png">
<label for="plain_title">Title:</label>
<input id="plain_title" name="plain_title" type="text" value="My super awesome notification">
<label for="plain_message">Message:</label>
<textarea id="plain_message" name="plain_message">Some random message we'd like to show our visitor.</textarea>
<input id="plain_submit" name="plain_submit" type="submit" value="Show notification" class="submit">
<div id="plain_debug" class="debug">Waiting for submit..<br></div>
</fieldset>
</form>
</div>
<div id="html_notification">
<h3>HTML</h3>
<p>This seems to have been <a href="https://code.google.com/p/chromium/issues/detail?id=137297">deprecated</a> July 13th, 2012.</p>
<form id="html_form" action="#" method="post">
<fieldset>
<label for="html_file">File/URL:</label>
<input id="html_file" name="html_file" type="text" value="notification.html">
<input id="html_submit" name="html_submit" type="submit" value="Show notification" class="submit">
<div id="html_debug" class="debug">Waiting for submit..<br></div>
</fieldset>
</form>
</div>
</div>
</section>
</div>
</div>
<footer class="container">
<p>Created with grog by <a href="http://dangercove.com" target="_blank">Danger Cove</a> in 2012</p>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/script.js"></script>
<script>
var _gaq=[['_setAccount','UA-27275793-4'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</body>
</html>