Overview.src.html
author Edward O'Connor <eoconnor@apple.com>
Wed, 30 Apr 2014 14:35:22 -0700
changeset 38 5147c445380d
parent 37 d0c65054fdec
child 39 954dc2126532
permissions -rw-r--r--
Merge WHATWG commit e91cbf5.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
     1
<!doctype html>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
     2
<html lang=en-US>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
     3
<meta charset=utf-8>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
     4
<title>Web Notifications</title>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
     5
<style>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
     6
 pre.idl { border:solid thin; background:#eee; color:#000; padding:0.5em 1em }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
     7
 pre.idl :link, pre.idl :visited { color:inherit; background:transparent }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
     8
 pre code { color:inherit; background:transparent }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
     9
 pre.css { border: solid 0.0625em; background: #FFFFEE; color: black; padding: 0.5em 1em; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    10
 .example { margin-left:1em; padding-left:1em; border-left:double; color:#222; background:#fcfcfc }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    11
 .note { margin-left:2em; font-weight:bold; font-style:italic; color:#008000 }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    12
 p.note::before { content:"Note: " }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    13
 .XXX { padding:.5em; border:solid #f00 }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    14
 p.XXX::before { content:"Issue: " }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    15
 dl.switch { padding-left:2em }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    16
 dl.switch > dt { text-indent:-1.5em }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    17
 dl.switch > dt:before { content:'\21AA'; padding:0 0.5em 0 0; display:inline-block; width:1em; text-align:right; line-height:0.5em }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    18
 dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    19
 dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    20
 dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    21
 dl.domintro dd p { margin: 0.5em 0; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    22
 dl.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    23
 em.ct { text-transform:lowercase; font-variant:small-caps; font-style:normal }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    24
 dfn { font-weight:bold; font-style:normal }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    25
 code { color:orangered }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    26
 code :link, code :visited { color:inherit }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    27
 hr:not(.top) { display:block; background:none; border:none; padding:0; margin:2em 0; height:auto }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    28
 table { border-collapse:collapse; border-style:hidden hidden none hidden }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    29
 table thead { border-bottom:solid }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    30
 table tbody th:first-child { border-left:solid }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    31
 table td, table th { border-left:solid; border-right:solid; border-bottom:solid thin; vertical-align:top; padding:0.2em }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    32
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    33
 .warning { color: red; background: transparent; font-weight: bolder; font-style: italic; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    34
 .warning p:first-child { margin-top: 0; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    35
 .warning p:last-child { margin-bottom: 0; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    36
 .warning:before { font-style: normal; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    37
 p.warning:before { content: '\26A0 Warning! '; }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    38
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    39
 @media print {
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    40
   [data-anolis-spec]::after { content:"[" attr(data-anolis-spec) "]"; font-size:.6em; vertical-align:super; text-transform:uppercase }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    41
 }
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    42
</style>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    43
<link rel=stylesheet href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS]">
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    44
<div class=head>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    45
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    46
<!-- logo -->
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    47
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    48
<h1>Web Notifications</h1>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    49
<h2 class="no-num no-toc">[LONGSTATUS] [DATE: 01 Jan 1901]</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    50
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    51
<dl>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    52
 <dt>This Version:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    53
 <dd class=dontpublish><a href="http://dvcs.w3.org/hg/notifications/raw-file/tip/Overview.html">http://dvcs.w3.org/hg/notifications/raw-file/tip/Overview.html</a>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    54
 <dd class=publish><a href="[VERSION]">[VERSION]</a>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    55
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    56
 <dt class=publish>Latest Version:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    57
 <dd class=publish><a href="[LATEST]">[LATEST]</a>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    58
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    59
 <dt class=publish>Latest Editors Draft:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    60
 <dd class=publish><a href="http://dvcs.w3.org/hg/notifications/raw-file/tip/Overview.html">http://dvcs.w3.org/hg/notifications/raw-file/tip/Overview.html</a>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    61
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    62
 <dt class=dontpublish>Participate:</dt>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    63
 <dd class=dontpublish>Send feedback to
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    64
  <a href="mailto:public-web-notification@w3.org">public-web-notification@w3.org</a>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    65
  (<a href=http://lists.w3.org/Archives/Public/public-web-notification/>archives</a>)
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    66
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    67
 <dt>Version History:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    68
 <dd><a href="http://dvcs.w3.org/hg/notifications/shortlog">http://dvcs.w3.org/hg/notifications/shortlog</a></dd>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    69
29
f8d950585cdf more previous versions
Anne van Kesteren <annevk@opera.com>
parents: 28
diff changeset
    70
 <dt>Previous Versions:</dt>
f8d950585cdf more previous versions
Anne van Kesteren <annevk@opera.com>
parents: 28
diff changeset
    71
 <dd><a href="http://www.w3.org/TR/2012/WD-notifications-20120614/">http://www.w3.org/TR/2012/WD-notifications-20120614/</a>
10
9d74ad61c3c8 previous version
Anne van Kesteren <annevk@opera.com>
parents: 9
diff changeset
    72
 <dd><a href="http://www.w3.org/TR/2011/WD-notifications-20110301/">http://www.w3.org/TR/2011/WD-notifications-20110301/</a>
9d74ad61c3c8 previous version
Anne van Kesteren <annevk@opera.com>
parents: 9
diff changeset
    73
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
    74
 <dt>W3C Editor:
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
    75
 <dd>John Gregg (<a href="http://www.google.com/">Google</a>)
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
    76
 &lt;<a href="mailto:johnnyg@google.com">johnnyg@google.com</a>&gt;</dd>
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
    77
 <dt>WHATWG Editor:
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    78
 <dd><a href="http://annevankesteren.nl/">Anne van Kesteren</a>
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
    79
 (<a href="http://www.mozilla.org/">Mozilla</a>)
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    80
 &lt;<a href="mailto:annevk@annevk.nl">annevk@annevk.nl</a>&gt;</dd>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    81
</dl>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    82
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    83
<!-- copyright -->
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    84
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    85
</div>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    86
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    87
<hr>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    88
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    89
<h2 class="no-num no-toc">Abstract</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    90
14
b7484c2b2d43 better abstract
Anne van Kesteren <annevk@opera.com>
parents: 13
diff changeset
    91
<p>Web notifications defines an API for end-user notifications. A
b7484c2b2d43 better abstract
Anne van Kesteren <annevk@opera.com>
parents: 13
diff changeset
    92
notification allows alerting the user outside the context of a web page of
b7484c2b2d43 better abstract
Anne van Kesteren <annevk@opera.com>
parents: 13
diff changeset
    93
an occurrence, such as the delivery of email.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    94
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    95
<h2 class="no-num no-toc" id="sotd">Status of this document</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
    96
11
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
    97
<p><em>This section describes the status of this document at the time of its
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
    98
publication. Other documents may supersede this document. A list of current
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
    99
W3C publications and the latest revision of this technical report can be
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   100
found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a>
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   101
at http://www.w3.org/TR/.</em>
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   102
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   103
<p>This is the [DATE: 3 August 2002] [LONGSTATUS] of Web Notifications.
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   104
Please send comments to
12
Anne van Kesteren <annevk@opera.com>
parents: 11
diff changeset
   105
<a href="mailto:public-web-notification@w3.org">public-web-notification@w3.org</a>
11
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   106
(<a href="http://lists.w3.org/Archives/Public/public-web-notification/">archived</a>).
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   107
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   108
<p class="alt">The bulk of the text of this specification is also
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   109
available in the
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   110
WHATWG <a href="http://notifications.spec.whatwg.org/">Notifications API
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   111
Standard</a>, under a license that permits reuse of the specification
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   112
text.</p>
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   113
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   114
<p>The W3C
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   115
<a href="http://www.w3.org/2010/web-notifications/">Web Notification
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   116
Working Group</a> is the W3C working group responsible for this
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   117
specification's progress along the W3C Recommendation track. The Working
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   118
Group expects to advance this Working Draft to Recommendation
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   119
Status.</p>
11
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   120
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   121
<p>Publication as a Working Draft does not imply endorsement by the W3C
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   122
Membership. This is a draft document and may be updated, replaced or
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   123
obsoleted by other documents at any time. It is inappropriate to cite this
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   124
document as other than work in progress.
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   125
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   126
<p>This document was produced by a group operating under the
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   127
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>.
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   128
W3C maintains a
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   129
<a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/45313/status">public list of any patent disclosures</a>
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   130
made in connection with the deliverables of the group; that page also
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   131
includes instructions for disclosing a patent. An individual who has actual
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   132
knowledge of a patent which the individual believes contains
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   133
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a>
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   134
must disclose the information in accordance with
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   135
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.
b33be5d0cde1 add version for publication
Anne van Kesteren <annevk@opera.com>
parents: 10
diff changeset
   136
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   137
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   138
<h2 class="no-num no-toc">Table of contents</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   139
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   140
<!-- toc -->
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   141
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   142
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   143
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   144
<h2>Introduction</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   145
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   146
<p>This specification provides an API to display notifications to alert
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   147
users outside the context of a web page. It does not specify exactly how a
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   148
user agent should display these notifications; the best presentation depends
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   149
on the device where the user agent is run. When this specification refers
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   150
to displaying notifications on the "desktop", it generally refers to some
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   151
static display area outside the web page, but may take several forms,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   152
including:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   153
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   154
<ul>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   155
 <li>A corner of the user's display.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   156
 <li>An area within the chrome of the user agent.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   157
 <li>The "home" screen of a mobile device.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   158
</ul>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   159
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   160
<p>This specification does not define exactly how the user agent should
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   161
display the notification, and the API is designed to be flexible with
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   162
respect to presentation options.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   163
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   164
<p>This specification is designed to be compatible with existing
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   165
notification platforms as much as possible, but also to be
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   166
platform-independent. Since the common platforms do not provide the same
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   167
functionality, this spec will indicate what events are guaranteed and
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   168
which are not. In particular, notifications as specified here only can
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   169
contain text and icon content.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   170
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   171
<p>In general, the event model for notifications is best-effort; while the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   172
<code>Notification</code> object offers a <code title>click</code> event,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   173
applications may enhance their functionality by listening for that event,
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   174
but cannot depend on receiving it, in case the underlying
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   175
notification platform does not provide that capability.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   176
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   177
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   178
<h2>Conformance</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   179
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   180
<p>All diagrams, examples, and notes in this specification are
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   181
non-normative, as are all sections explicitly marked non-normative.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   182
Everything else in this specification is normative.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   183
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   184
<p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   185
NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   186
"OPTIONAL" in the normative parts of this specification are to be
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   187
interpreted as described in RFC2119. For readability, these words do
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   188
not appear in all uppercase letters in this specification.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   189
<span data-anolis-ref>RFC2119</span>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   190
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   191
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   192
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   193
<h3>Security</h3>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   194
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   195
<p>Notifications should only be presented when the user has indicated they
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   196
are desired; without this they could create a negative experience for the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   197
user.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   198
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   199
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   200
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   201
<h2>Terminology</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   202
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   203
<p>Most terminology used in this specification is from DOM, HTML, IDL, and URL.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   204
<span data-anolis-ref>DOM</span>
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   205
<span data-anolis-ref>HTML</span>
22
173cbf4ae2b8 IDL defines static attributes now
Anne van Kesteren <annevk@opera.com>
parents: 21
diff changeset
   206
<span data-anolis-ref>WEBIDL</span>
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   207
<span data-anolis-ref>URL</span>
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   208
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   209
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   210
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   211
<h2>Model</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   212
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   213
<p>A <dfn title=concept-notification>notification</dfn> allows alerting the
6
Anne van Kesteren <annevk@opera.com>
parents: 5
diff changeset
   214
user outside the context of a web page of an occurrence, such as the
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   215
delivery of email.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   216
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   217
<p>Each <span title=concept-notification>notification</span> has a
28
7acbce272677 fix <dfn> IDs
Anne van Kesteren <annevk@opera.com>
parents: 27
diff changeset
   218
<dfn>title</dfn>, <dfn id=direction>direction</dfn>,
7acbce272677 fix <dfn> IDs
Anne van Kesteren <annevk@opera.com>
parents: 27
diff changeset
   219
<dfn id=language>language</dfn>, and an <dfn>origin</dfn>.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   220
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   221
<p>Each <span title=concept-notification>notification</span> <em>can</em>
21
19d209b18660 stop throwing an error event and always display the notification when the icon failed to load or decode http://lists.w3.org/Archives/Public/public-web-notification/2012Jun/0045.html
Anne van Kesteren <annevk@opera.com>
parents: 20
diff changeset
   222
have an associated <dfn>body</dfn>, <dfn>tag</dfn>, <dfn>icon URL</dfn>, and
38
5147c445380d Merge WHATWG commit e91cbf5.
Edward O'Connor <eoconnor@apple.com>
parents: 37
diff changeset
   223
<dfn>icon image</dfn>.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   224
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   225
27
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   226
<h3>Direction</h3>
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   227
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   228
<p>This section is written in terms equivalent to those used in the
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   229
Rendering section of HTML. <span data-anolis-ref>HTML</span>
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   230
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   231
<!-- keep this in sync with
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   232
     http://www.whatwg.org/specs/web-apps/current-work/#text-rendered-in-native-user-interfaces -->
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   233
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   234
<p>User agents are expected to honor the Unicode semantics of the text of a
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   235
<span title=concept-notification>notification</span>'s <span>title</span>
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   236
and <span>body</span>. Each is expected to be treated as an independent set
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   237
of one or more bidirectional algorithm paragraphs when displayed, as defined
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   238
by the bidirectional algorithm's rules P1, P2, and P3, including, for
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   239
instance, supporting the paragraph-breaking behaviour of
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   240
U+000A LINE FEED (LF) characters. For each paragraph of the
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   241
<span>title</span> and <span>body</span>, the
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   242
<span title=concept-notification>notification</span>'s
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   243
<span>direction</span> provides the higher-level override of rules P2 and P3
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   244
if it has a value other than "<code title>auto</code>".
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   245
<span data-anolis-ref>BIDI</span>
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   246
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   247
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   248
<h3>Language</h3>
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   249
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   250
<!-- keep this in sync with
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   251
     http://www.whatwg.org/specs/web-apps/current-work/#attr-lang -->
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   252
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   253
<p>The <span title=concept-notification>notification</span>'s
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   254
<span>language</span> specifies the primary language for the
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   255
<span title=concept-notification>notification</span>'s <span>title</span>
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   256
and <span>body</span>. Its value is a valid BCP 47 language tag, or the
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   257
empty string. The empty string indicates that the primary language is
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   258
unknown. <span data-anolis-ref>LANG</span>
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   259
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   260
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   261
<h3>Permission</h3>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   262
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   263
<p><span title=concept-notification>Notifications</span> can only be
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   264
displayed if the user (or user agent on behalf of the user) has granted
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   265
<dfn>permission</dfn>. The <span>permission</span> to display
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   266
<span title=concept-notification>notifications</span> for a given
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   267
<span data-anolis-spec=origin>origin</span> can be one of three strings:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   268
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   269
<dl>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   270
 <dt>"<code title>default</code>"
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   271
 <dd><p>This is equivalent to "<code title>denied</code>", but the user has
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   272
 made no explicit choice thus far.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   273
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   274
 <dt>"<code title>denied</code>"
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   275
 <dd><p>This means the user does not want
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   276
 <span title=concept-notification>notifications</span>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   277
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   278
 <dt>"<code title>granted</code>"
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   279
 <dd><p>This means <span title=concept-notification>notifications</span> can
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   280
 be displayed.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   281
</dl>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   282
2
1693fc18292c fix grammar
Anne van Kesteren <annevk@opera.com>
parents: 1
diff changeset
   283
<p class=note>There is no equivalent to "<code title>default</code>"
1693fc18292c fix grammar
Anne van Kesteren <annevk@opera.com>
parents: 1
diff changeset
   284
meaning "<code title>granted</code>". In that case
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   285
"<code title>granted</code>" is simply returned as there would be no reason
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   286
for the application to ask for <span>permission</span>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   287
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   288
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   289
<h3>Notification lists</h3>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   290
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   291
<p>The user agent must keep a <dfn>list of pending notifications</dfn> and
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   292
a <dfn>list of active notifications</dfn>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   293
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   294
<h3>Showing a notification</h3>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   295
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   296
<p>The <dfn>show steps</dfn> for a given <var title>notification</var> are:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   297
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   298
<ol>
18
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   299
 <li><p>If <span>permission</span> for <var title>notification</var>'s
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   300
 <span>origin</span> is not "<code title>granted</code>", cancel any ongoing
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   301
 <span data-anolis-spec=html>fetch</span> for
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   302
 <var title>notification</var>'s <span>icon URL</span>,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   303
 <span data-anolis-spec=html>queue a task</span> to
18
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   304
 <span data-anolis-spec=dom title=concept-event-fire>fire an event</span>
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   305
 named <code title>error</code> on <var title>notification</var>, and
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   306
 terminate these steps.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   307
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   308
 <li><p>If there is a <span title=concept-notification>notification</span>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   309
 in the <span>list of pending notifications</span> or the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   310
 <span>list of active notifications</span> whose <span>tag</span> equals
18
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   311
 <var title>notification</var>'s <span>tag</span> and whose
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   312
 <span>origin</span> equals <var title>notification</var>'s
30
Anne van Kesteren <annevk@opera.com>
parents: 29
diff changeset
   313
 <span>origin</span>, run the <span>replace steps</span> for that
17
cf99a4f443ee invoke the replace steps with notifications
Anne van Kesteren <annevk@opera.com>
parents: 16
diff changeset
   314
 <span title=concept-notification>notification</span> and
cf99a4f443ee invoke the replace steps with notifications
Anne van Kesteren <annevk@opera.com>
parents: 16
diff changeset
   315
 <var title>notification</var>, and then terminate these steps.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   316
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   317
 <li><p>If the device allows notifications to be displayed immediately
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   318
 without limitations on the number of concurrent notifications, run
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   319
 the <span>display steps</span> and terminate these steps.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   320
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   321
 <li><p>If the device has limitations on the number of concurrent
35
baec5d686215 [editorial] Consistenly refer to 'notification platform(s)'.
Edward O'Connor <eoconnor@apple.com>
parents: 34
diff changeset
   322
 notifications, either immediately call to a notification platform which
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   323
 natively supports queueing, or append <var title>notification</var> to the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   324
 <span>list of pending notifications</span>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   325
</ol>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   326
34
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   327
<h3>Activating a notification</h3>
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   328
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   329
<p>When a <span title=concept-notification>notification</span>
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   330
<var title>notification</var> is activated by the user, assuming the underlying
35
baec5d686215 [editorial] Consistenly refer to 'notification platform(s)'.
Edward O'Connor <eoconnor@apple.com>
parents: 34
diff changeset
   331
notification platform supports activation, the user agent must, for each
34
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   332
<code>Notification</code> object representing <var title>notification</var>,
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   333
<span data-anolis-spec=html>queue a task</span> to
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   334
<span data-anolis-spec=dom title=concept-event-fire>fire an event</span>
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   335
named <code title>click</code> on the <code>Notification</code> object.
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   336
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   337
<p class=note>Throughout the web platform "activate" is intentionally misnamed as "click".
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   338
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   339
<h3>Closing a notification</h3>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   340
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   341
<p>When a <span title=concept-notification>notification</span> is closed,
35
baec5d686215 [editorial] Consistenly refer to 'notification platform(s)'.
Edward O'Connor <eoconnor@apple.com>
parents: 34
diff changeset
   342
either by the underlying notification platform or by the user, the
3
Anne van Kesteren <annevk@opera.com>
parents: 2
diff changeset
   343
<span>close steps</span> for it must be run.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   344
3
Anne van Kesteren <annevk@opera.com>
parents: 2
diff changeset
   345
<p>The <dfn>close steps</dfn> for a given <var title>notification</var> are:
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   346
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   347
<ol>
3
Anne van Kesteren <annevk@opera.com>
parents: 2
diff changeset
   348
 <li><p>If <var title>notification</var> is neither in the
Anne van Kesteren <annevk@opera.com>
parents: 2
diff changeset
   349
 <span>list of pending notifications</span> nor in the
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   350
 <span>list of active notifications</span>, terminate these steps.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   351
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   352
 <li><p><span data-anolis-spec=html>Queue a task</span> to remove
3
Anne van Kesteren <annevk@opera.com>
parents: 2
diff changeset
   353
 <var title>notification</var> from either the
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   354
 <span>list of pending notifications</span> or the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   355
 <span>list of active notifications</span>, and
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   356
 <span data-anolis-spec=dom title=concept-event-fire>fire an event</span>
3
Anne van Kesteren <annevk@opera.com>
parents: 2
diff changeset
   357
 named <code title>close</code> on <var title>notification</var>.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   358
</ol>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   359
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   360
<h3>Pending notifications</h3>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   361
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   362
<p>Whenever the <span>list of pending notifications</span> is not empty, the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   363
user agent must wait and monitor changes in the available notification space
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   364
on the device.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   365
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   366
<p>When the available display space changes on the device such that a new
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   367
notification can be displayed, for example due to a previous notification
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   368
being dismissed, the user agent should run the <span>display steps</span>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   369
for the first <span title=concept-notification>notification</span> in the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   370
<span>list of pending notifications</span> and then remove it from the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   371
<span>list of pending notifications</span>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   372
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   373
<h3>Displaying notifications</h3>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   374
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   375
<p>The <dfn>display steps</dfn> for a given <var title>notification</var>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   376
are:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   377
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   378
<ol>
24
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   379
 <li>
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   380
  <p>If the notification platform supports icons,
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   381
  <var title>notification</var>'s <span>icon URL</span> is set and has not
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   382
  yet been <span data-anolis-spec=html title=fetch>fetched</span>,
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   383
  <span data-anolis-spec=html>fetch</span> it and wait for the resource to
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   384
  be fully downloaded.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   385
24
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   386
  <p>Once <span data-anolis-spec=html title=fetch>fetching</span> has
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   387
  finished and the image format is supported, set
38
5147c445380d Merge WHATWG commit e91cbf5.
Edward O'Connor <eoconnor@apple.com>
parents: 37
diff changeset
   388
  <var title>notification</var>'s <span>icon image</span> to the decoded resource.
5147c445380d Merge WHATWG commit e91cbf5.
Edward O'Connor <eoconnor@apple.com>
parents: 37
diff changeset
   389
  (Otherwise <var title>notification</var> has no <span>icon image</span>.)
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   390
20
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   391
 <li>
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   392
  <p><span data-anolis-spec=html>Queue a task</span> to run these substeps:
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   393
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   394
  <ol>
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   395
   <li><p>Display <var title>notification</var> on the device (e.g. by
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   396
   calling the appropriate notification platform).
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   397
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   398
   <li><p>If displaying fails (e.g. the notification platform returns an
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   399
   error),
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   400
   <span data-anolis-spec=dom title=concept-event-fire>fire an event</span>
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   401
   named <code title>error</code> on <var title>notification</var> and
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   402
   terminate these steps.
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   403
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   404
   <li><p>Append <var title>notification</var> to the
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   405
   <span>list of active notifications</span>.
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   406
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   407
   <li><p><span data-anolis-spec=dom title=concept-event-fire>Fire an event</span>
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   408
   named <code title>show</code> on <var title>notification</var>.
f1ad5e88360a displaying can fail
Anne van Kesteren <annevk@opera.com>
parents: 19
diff changeset
   409
  </ol>
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   410
</ol>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   411
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   412
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   413
<h3>Replacing a notification</h3>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   414
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   415
<p>The <dfn>replace steps</dfn> for replacing an <var title>old</var>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   416
<span title=concept-notification>notification</span> with a
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   417
<var title>new</var> one are:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   418
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   419
<ol>
30
Anne van Kesteren <annevk@opera.com>
parents: 29
diff changeset
   420
 <li>
24
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   421
  <p>If the notification platform supports icons,
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   422
  <var title>new</var>'s <span>icon URL</span> is set and has not
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   423
  yet been <span data-anolis-spec=html title=fetch>fetched</span>,
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   424
  <span data-anolis-spec=html>fetch</span> it and wait for the resource to
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   425
  be fully downloaded.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   426
24
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   427
  <p>Once <span data-anolis-spec=html title=fetch>fetching</span> has
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   428
  finished and the image format is supported, set
38
5147c445380d Merge WHATWG commit e91cbf5.
Edward O'Connor <eoconnor@apple.com>
parents: 37
diff changeset
   429
  <var title>new</var>'s <span>icon image</span> to the decoded resource.
5147c445380d Merge WHATWG commit e91cbf5.
Edward O'Connor <eoconnor@apple.com>
parents: 37
diff changeset
   430
  (Otherwise <var title>new</var> has no <span>icon image</span>.)
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   431
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   432
 <li><p>If <var title>old</var> is in the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   433
 <span>list of pending notifications</span>,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   434
 <span data-anolis-spec=html>queue a task</span> to replace
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   435
 <var title>old</var> with <var title>new</var>, in the same position, in
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   436
 the <span>list of pending notifications</span>, and
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   437
 <span data-anolis-spec=dom title=concept-event-fire>fire an event</span>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   438
 named <code title>close</code> on <var title>old</var>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   439
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   440
 <li>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   441
  <p>Otherwise,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   442
  <span data-anolis-spec=html>queue a task</span> to replace
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   443
  <var title>old</var> with <var title>new</var>, in the same position, in
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   444
  the <span>list of active notifications</span>,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   445
  <span data-anolis-spec=dom title=concept-event-fire>fire an event</span>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   446
  named <code title>close</code> on <var title>old</var>, and
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   447
  <span data-anolis-spec=dom title=concept-event-fire>fire an event</span>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   448
  named <code title>show</code> on <var title>new</var>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   449
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   450
  <p>If the notification platform does not support replacement this
19
86086a7b2302 make alternative for relacing a little less vague
Anne van Kesteren <annevk@opera.com>
parents: 18
diff changeset
   451
  requirement may be addressed by running the <span>close steps</span> for
86086a7b2302 make alternative for relacing a little less vague
Anne van Kesteren <annevk@opera.com>
parents: 18
diff changeset
   452
  <var title>old</var> and then running the <span>display steps</span> for
86086a7b2302 make alternative for relacing a little less vague
Anne van Kesteren <annevk@opera.com>
parents: 18
diff changeset
   453
  <var title>new</var>.
86086a7b2302 make alternative for relacing a little less vague
Anne van Kesteren <annevk@opera.com>
parents: 18
diff changeset
   454
86086a7b2302 make alternative for relacing a little less vague
Anne van Kesteren <annevk@opera.com>
parents: 18
diff changeset
   455
  <p class=note>Notification platforms are strongly encouraged to support
86086a7b2302 make alternative for relacing a little less vague
Anne van Kesteren <annevk@opera.com>
parents: 18
diff changeset
   456
  native replacement. It is much nicer.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   457
</ol>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   458
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   459
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   460
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   461
<h2>API</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   462
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   463
<p>A <span title=concept-notification>notification</span> is represented by
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   464
a <code>Notification</code> object and can be created by its
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   465
<span title=dom-Notification>constructor</span>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   466
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   467
<pre class="idl">[<span title=dom-Notification>Constructor</span>(DOMString <var title>title</var>, optional <span>NotificationOptions</span> <var title>options</var>)]
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   468
interface <dfn>Notification</dfn> : <span data-anolis-spec=dom>EventTarget</span> {
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   469
  static readonly attribute <span>NotificationPermission</span> <span title=dom-Notification-permission>permission</span>;
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   470
  static void <span title=dom-Notification-requestPermission>requestPermission</span>(optional <span>NotificationPermissionCallback</span> <var title>callback</var>);
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   471
25
914cfd6e0f75 sync with HTML which synced with IDL for event handlers
Anne van Kesteren <annevk@opera.com>
parents: 24
diff changeset
   472
  attribute <span data-anolis-spec=html>EventHandler</span> <span title=handler-onclick>onclick</span>;
914cfd6e0f75 sync with HTML which synced with IDL for event handlers
Anne van Kesteren <annevk@opera.com>
parents: 24
diff changeset
   473
  attribute <span data-anolis-spec=html>EventHandler</span> <span title=handler-onshow>onshow</span>;
914cfd6e0f75 sync with HTML which synced with IDL for event handlers
Anne van Kesteren <annevk@opera.com>
parents: 24
diff changeset
   474
  attribute <span data-anolis-spec=html>EventHandler</span> <span title=handler-onerror>onerror</span>;
914cfd6e0f75 sync with HTML which synced with IDL for event handlers
Anne van Kesteren <annevk@opera.com>
parents: 24
diff changeset
   475
  attribute <span data-anolis-spec=html>EventHandler</span> <span title=handler-onclose>onclose</span>;
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   476
36
41c928b92c07 Merge editorial/bugfix changes in WHATWG commit 6896a25, but not the entangled Promises changes.
Edward O'Connor <eoconnor@apple.com>
parents: 35
diff changeset
   477
  readonly attribute DOMString <span title=dom-Notification-title>title</span>;
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   478
  readonly attribute <span>NotificationDirection</span> <span title=dom-Notification-dir>dir</span>;
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   479
  readonly attribute DOMString <span title=dom-Notification-dir>lang</span>;
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   480
  readonly attribute DOMString <span title=dom-Notification-dir>body</span>;
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   481
  readonly attribute DOMString <span title=dom-Notification-dir>tag</span>;
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   482
  readonly attribute DOMString <span title=dom-Notification-dir>icon</span>;
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   483
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   484
  void <span title=dom-Notification-close>close</span>();
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   485
};
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   486
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   487
dictionary <dfn>NotificationOptions</dfn> {
27
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   488
  <span>NotificationDirection</span> dir = "auto";
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   489
  DOMString lang = "";
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   490
  DOMString body;
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   491
  DOMString tag;
26
381a000f6e48 rename iconUrl to icon to allow for reuse with e.g. HTMLImageElement later
Anne van Kesteren <annevk@opera.com>
parents: 25
diff changeset
   492
  DOMString icon;
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   493
};
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   494
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   495
enum <dfn>NotificationPermission</dfn> {
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   496
  "default",
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   497
  "denied",
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   498
  "granted"
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   499
};
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   500
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   501
callback <dfn>NotificationPermissionCallback</dfn> = void (<span>NotificationPermission</span> <var title>permission</var>);
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   502
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   503
enum <dfn>NotificationDirection</dfn> {
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   504
  "auto",
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   505
  "ltr",
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   506
  "rtl"
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   507
};</pre>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   508
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   509
<p>The
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   510
<dfn title=dom-Notification><code>Notification(<var title>title</var>, <var title>options</var>)</code></dfn>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   511
constructor must run these steps:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   512
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   513
<ol>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   514
 <li><p>Let <var title>notification</var> be a new
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   515
 <span title=concept-notification>notification</span> represented by a
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   516
 <code>Notification</code> object.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   517
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   518
 <li><p>Set <var title>notification</var>'s <span>title</span> to
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   519
 <var title>title</var>.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   520
27
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   521
 <li><p>Set <var title>notification</var>'s <span>direction</span> to
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   522
 <var title>options</var>'s <code title>dir</code>.
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   523
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   524
 <li><p>If <var title>options</var>'s <code title>lang</code> is a valid
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   525
 BCP 47 language tag, or the empty string, set
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   526
 <var title>notification</var>'s <span>language</span> to
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   527
 <var title>options</var>'s <code title>lang</code>, or set it to the empty
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   528
 string otherwise. <span data-anolis-ref>LANG</span>
ab7a04f3700a update the spec to use dir/lang
Anne van Kesteren <annevk@opera.com>
parents: 26
diff changeset
   529
18
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   530
 <li><p>Set <var title>notifications</var>'s <span>origin</span> to the
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   531
 current <span data-anolis-spec=origin>origin</span>.
93c6983ce465 do not use a tuple for tag
Anne van Kesteren <annevk@opera.com>
parents: 17
diff changeset
   532
23
c385e2d54c8c dictionaries are always passed per new IDL rules
Anne van Kesteren <annevk@opera.com>
parents: 22
diff changeset
   533
 <li><p>If <var title>options</var>'s <code title>body</code> is present,
c385e2d54c8c dictionaries are always passed per new IDL rules
Anne van Kesteren <annevk@opera.com>
parents: 22
diff changeset
   534
 set <var title>notification</var>'s <span>body</span> to
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   535
 <code title>body</code>.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   536
23
c385e2d54c8c dictionaries are always passed per new IDL rules
Anne van Kesteren <annevk@opera.com>
parents: 22
diff changeset
   537
 <li><p>If <var title>options</var>'s <code title>tag</code> is present, set
c385e2d54c8c dictionaries are always passed per new IDL rules
Anne van Kesteren <annevk@opera.com>
parents: 22
diff changeset
   538
 <var title>notification</var>'s <span>tag</span> to <code title>tag</code>.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   539
26
381a000f6e48 rename iconUrl to icon to allow for reuse with e.g. HTMLImageElement later
Anne van Kesteren <annevk@opera.com>
parents: 25
diff changeset
   540
 <li><p>If <var title>options</var>'s <code title>icon</code> is present,
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   541
 <span title=concept-url-parser data-anolis-spec=url>parse</span>
37
d0c65054fdec Merge WHATWG commit e7f8336.
Edward O'Connor <eoconnor@apple.com>
parents: 36
diff changeset
   542
 <code title>icon</code> using the <span data-anolis-spec=html>API base URL</span>
d0c65054fdec Merge WHATWG commit e7f8336.
Edward O'Connor <eoconnor@apple.com>
parents: 36
diff changeset
   543
 specified by the <span data-anolis-spec=html>entry settings object</span>, and if that
d0c65054fdec Merge WHATWG commit e7f8336.
Edward O'Connor <eoconnor@apple.com>
parents: 36
diff changeset
   544
 does not return failure, set <var title>notification</var>'s <span>icon URL</span> to the
d0c65054fdec Merge WHATWG commit e7f8336.
Edward O'Connor <eoconnor@apple.com>
parents: 36
diff changeset
   545
 return value. (Otherwise <span>icon URL</span> is not set.)
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   546
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   547
 <li><p>Return <var title>notification</var>, but continue running these
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   548
 steps asynchronouusly.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   549
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   550
 <li><p>If the notification platform supports icons, the user agent may
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   551
 start <span data-anolis-spec=html title=fetch>fetching</span>
24
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   552
 <var title>notification</var>'s <span>icon URL</span> at this point, if
d12d81df8cf3 define how iconUrl is resolved and what happens if that fails; also be clearer that the icon URL concept is not always set
Anne van Kesteren <annevk@opera.com>
parents: 23
diff changeset
   553
 <span>icon URL</span> is set.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   554
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   555
 <li><p>Run the <span>show steps</span> for <var title>notification</var>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   556
</ol>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   557
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   558
<p>The static
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   559
<dfn title=dom-Notification-permission><code>permission</code></dfn>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   560
attribute must return <span>permission</span>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   561
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   562
<p>The static
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   563
<dfn title=dom-Notification-requestPermission><code>requestPermission(<var title>callback</var>)</code></dfn>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   564
method must run these steps:
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   565
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   566
<ol>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   567
 <li><p>Return, but continue running these steps asynchronously.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   568
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   569
 <li><p>Let <var title>permission</var> be <span>permission</span>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   570
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   571
 <li><p>If <var title>permission</var> is "<code title>default</code>",
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   572
 ask the user whether showing notifications for the current
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   573
 <span data-anolis-spec=origin>origin</span> is acceptable. If it is, set
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   574
 <var title>permission</var> to "<code title>granted</code>", or
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   575
 "<code title>denied</code>" otherwise.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   576
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   577
 <li><p><span data-anolis-spec=html>Queue a task</span> to set
9
13eb4cb483c5 use permission concept
Anne van Kesteren <annevk@opera.com>
parents: 8
diff changeset
   578
 <span>permission</span> to <var title>permission</var> and invoke
13eb4cb483c5 use permission concept
Anne van Kesteren <annevk@opera.com>
parents: 8
diff changeset
   579
 <var title>callback</var> with <var title>permission</var> as single
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   580
 argument if <var title>callback</var> is given.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   581
</ol>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   582
8
f06ff848e6c0 mention the problem with the permission model used; mention the static attribute problem
Anne van Kesteren <annevk@opera.com>
parents: 7
diff changeset
   583
<p class=warning>In designing the platform notifications are the one
f06ff848e6c0 mention the problem with the permission model used; mention the static attribute problem
Anne van Kesteren <annevk@opera.com>
parents: 7
diff changeset
   584
instance thus far where asking the user upfront makes sense. Specifications
f06ff848e6c0 mention the problem with the permission model used; mention the static attribute problem
Anne van Kesteren <annevk@opera.com>
parents: 7
diff changeset
   585
for other APIs should not use this pattern and instead employ one of the
f06ff848e6c0 mention the problem with the permission model used; mention the static attribute problem
Anne van Kesteren <annevk@opera.com>
parents: 7
diff changeset
   586
<a href="http://robert.ocallahan.org/2011/06/permissions-for-web-applications_30.html">many more suitable alternatives</a>.
f06ff848e6c0 mention the problem with the permission model used; mention the static attribute problem
Anne van Kesteren <annevk@opera.com>
parents: 7
diff changeset
   587
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   588
<p>The following are the <span data-anolis-spec=html>event handlers</span>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   589
(and their corresponding
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   590
<span data-anolis-spec=html title="event handler event type">event handler event types</span>)
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   591
that must be supported as attributes by the <code>Notification</code> object.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   592
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   593
<table>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   594
 <thead>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   595
  <tr>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   596
   <th><span data-anolis-spec=html title="event handlers">event handler</span>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   597
   <th><span data-anolis-spec=html>event handler event type</span>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   598
 <tbody>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   599
  <tr>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   600
   <td><dfn title=handler-onclick><code>onclick</code></dfn>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   601
   <td><code title=event-click>click</code>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   602
  <tr>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   603
   <td><dfn title=handler-onshow><code>onshow</code></dfn>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   604
   <td><code title=event-show>show</code>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   605
  <tr>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   606
   <td><dfn title=handler-onerror><code>onerror</code></dfn>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   607
   <td><code title=event-error>error</code>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   608
  <tr>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   609
   <td><dfn title=handler-onclose><code>onclose</code></dfn>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   610
   <td><code title=event-close>close</code>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   611
</table>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   612
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   613
<p>The <dfn title=dom-Notification-close><code>close()</code></dfn> method
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   614
must run the <span>close steps</span> for the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   615
<span title=concept-notification>notification</span>.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   616
36
41c928b92c07 Merge editorial/bugfix changes in WHATWG commit 6896a25, but not the entangled Promises changes.
Edward O'Connor <eoconnor@apple.com>
parents: 35
diff changeset
   617
<p>The <dfn title=dom-Notification-title><code>title</code></dfn> attribute must return the
41c928b92c07 Merge editorial/bugfix changes in WHATWG commit 6896a25, but not the entangled Promises changes.
Edward O'Connor <eoconnor@apple.com>
parents: 35
diff changeset
   618
<span title=concept-notification>notification</span>'s <span>title</span>.
41c928b92c07 Merge editorial/bugfix changes in WHATWG commit 6896a25, but not the entangled Promises changes.
Edward O'Connor <eoconnor@apple.com>
parents: 35
diff changeset
   619
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   620
<p>The <dfn title=dom-Notification-dir><code>dir</code></dfn> attribute must return the
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   621
<span title=concept-notification>notification</span>'s <span>direction</span>.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   622
32
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   623
<p>The <dfn title=dom-Notification-lang><code>lang</code></dfn> attribute must return the
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   624
<span title=concept-notification>notification</span>'s <span>language</span>.
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   625
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   626
<p>The <dfn title=dom-Notification-body><code>body</code></dfn> attribute must return the
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   627
<span title=concept-notification>notification</span>'s <span>body</span> and the empty
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   628
string otherwise.
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   629
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   630
<p>The <dfn title=dom-Notification-tag><code>tag</code></dfn> attribute must return the
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   631
<span title=concept-notification>notification</span>'s <span>tag</span> and the empty
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   632
string otherwise.
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   633
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   634
<p>The <dfn title=dom-Notification-icon><code>icon</code></dfn> attribute must return the
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   635
<span title=concept-notification>notification</span>'s <span>icon URL</span>,
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   636
<span title=concept-url-serializer data-anolis-spec=url>serialized</span>, and the
498b5397ed3f Apply b7f3cc1, dd39ee4,and 998421f from the WHATWG Notifications document.
Edward O'Connor <eoconnor@apple.com>
parents: 31
diff changeset
   637
empty string otherwise.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   638
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   639
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   640
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   641
<h2>Examples</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   642
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   643
<h3>Using events</h3>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   644
13
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   645
<p><code>Notification</code> objects dispatch events during their lifecycle,
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   646
which developers can use to generate desired behaviors.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   647
13
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   648
<p>The <code title=event-show>show</code> event dispatches when the
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   649
<span title=concept-notification>notification</span> is shown to the user
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   650
&mdash; this may be at some time after the notification is created in the
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   651
case of limited display space and a queue.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   652
13
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   653
<p>In the following example, this event is used to guarantee that regardless
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   654
of when the notification is shown, it is displayed for only 15 seconds.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   655
26
381a000f6e48 rename iconUrl to icon to allow for reuse with e.g. HTMLImageElement later
Anne van Kesteren <annevk@opera.com>
parents: 25
diff changeset
   656
<pre class="example">var notification = new Notification("New Email Received", { icon: "mail.png" })
15
954c3bcb5527 hzr corrects some JavaScript
Anne van Kesteren <annevk@opera.com>
parents: 14
diff changeset
   657
notification.onshow = function() { setTimeout(notification.close, 15000) }</pre>
13
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   658
30
Anne van Kesteren <annevk@opera.com>
parents: 29
diff changeset
   659
<p>The <code title=event-close>close</code> event dispatches when the
13
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   660
notification is dismissed by the user. Developers may use this event to
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   661
perform actions when notifications are acknowledged.
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   662
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   663
<p>In the following example, when a meeting reminder notification is
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   664
acknowledged, the application suppresses other forms of reminders.
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   665
26
381a000f6e48 rename iconUrl to icon to allow for reuse with e.g. HTMLImageElement later
Anne van Kesteren <annevk@opera.com>
parents: 25
diff changeset
   666
<pre class="example">var notification = new Notification("Meeting about to begin", { icon: "calendar.gif", body: "Room 101" })
13
e6822fd2e4f2 fix examples using event handlers
Anne van Kesteren <annevk@opera.com>
parents: 12
diff changeset
   667
notification.onclose = function(event) { cancelReminders(event) }</pre>
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   668
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   669
7
5f2b3a2f7c6c tag is not an attribute anymore, strictly speaking
Anne van Kesteren <annevk@opera.com>
parents: 6
diff changeset
   670
<h3 id="tags-example">Using the <code title>tag</code> member for multiple instances</h3>
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   671
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   672
<p>Web applications frequently operate concurrently in multiple instances, such as when a
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   673
	user opens a mail application in multiple browser tabs.  Since the desktop is a shared
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   674
	resource, the notifications API provides a way for these instances to easily coordinate, by
7
5f2b3a2f7c6c tag is not an attribute anymore, strictly speaking
Anne van Kesteren <annevk@opera.com>
parents: 6
diff changeset
   675
	using the <code title>tag</code> member.
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   676
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   677
<p>Notifications which represent the same conceptual event can be tagged in the same way,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   678
	and when both are shown, the user will only receive one notification.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   679
      </p>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   680
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   681
<pre class="example" title="">Instance 1                                   | Instance 2
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   682
                                             |
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   683
// Instance notices there is new mail.       |
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   684
new Notification("New mail from John Doe",   |
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   685
                 { tag: 'message1' });       |
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   686
                                             |
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   687
                                             |  // Slightly later, this instance notices
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   688
                                             |  // there is new mail.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   689
                                             |  new Notification("New mail from John Doe",
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   690
                                             |                   { tag: 'message1' });</pre>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   691
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   692
<p>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   693
	The result of this situation, if the user agent follows the algorithms here, is a <strong>single</strong> notification "New mail from John Doe".
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   694
7
5f2b3a2f7c6c tag is not an attribute anymore, strictly speaking
Anne van Kesteren <annevk@opera.com>
parents: 6
diff changeset
   695
<h3>Using the <code title>tag</code> member for a single instance</h3>
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   696
7
5f2b3a2f7c6c tag is not an attribute anymore, strictly speaking
Anne van Kesteren <annevk@opera.com>
parents: 6
diff changeset
   697
<p>The <code title>tag</code> member can also be used by a single instance of an application to keep its
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   698
	notifications as current as possible as state changes.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   699
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   700
<p>For example, if Alice is using a chat application with Bob, and Bob sends multiple
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   701
	messages while Alice is idle, the application may prefer that Alice not see a
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   702
	desktop notification for each message.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   703
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   704
<pre class="example">// Bob says "Hi"
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   705
new Notification("Bob: Hi", { tag: 'chat_Bob' });
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   706
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   707
// Bob says "Are you free this afternoon?"
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   708
new Notification("Bob: Hi / Are you free this afternoon?", { tag: 'chat_Bob' });</pre>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   709
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   710
<p>The result of this situation is a <em>single</em> notification; the second one
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   711
	replaces the first having the same tag.  In a platform that queues notifications
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   712
	(first-in-first-out), using the tag allows the notification to also maintain its
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   713
	position in the queue.  Platforms where the newest notifications are shown first,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   714
	a similar result could be achieved using the
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   715
	<code title=dom-Notification-close>close()</code> method.
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   716
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   717
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   718
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   719
<h2 class=no-num>References</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   720
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   721
<div id=anolis-references></div>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   722
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   723
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   724
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   725
<h2 class=no-num>Acknowledgments</h2>
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   726
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   727
<p>Thanks to
5
ce7609323bc7 bidi: http://lists.w3.org/Archives/Public/public-web-notification/2012Jun/0003.html
Anne van Kesteren <annevk@opera.com>
parents: 4
diff changeset
   728
Aharon (Vladimir) Lanin,
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   729
Alex Russell,
15
954c3bcb5527 hzr corrects some JavaScript
Anne van Kesteren <annevk@opera.com>
parents: 14
diff changeset
   730
David Håsäther,
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   731
Doug Turner,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   732
Drew Wilson,
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   733
Jake Archibald,
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   734
Edward O'Connor,
34
c0cf2410619b Merge WHATWG change which clarifies that some platforms provide an notification activation feature.
Edward O'Connor <eoconnor@apple.com>
parents: 32
diff changeset
   735
Frederick Hirsch,
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   736
Ian Hickson,
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   737
James Graham,
16
563e9af218b9 bind tag to an origin
Anne van Kesteren <annevk@opera.com>
parents: 15
diff changeset
   738
Jon Lee,
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   739
Jonas Sicking,
36
41c928b92c07 Merge editorial/bugfix changes in WHATWG commit 6896a25, but not the entangled Promises changes.
Edward O'Connor <eoconnor@apple.com>
parents: 35
diff changeset
   740
Michael Henretty,
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   741
Olli Pettay, and
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   742
Simon Pieters
1
0f513d43130e alternative Anolis draft with a few text improvements as well as the permission model
Anne van Kesteren <annevk@opera.com>
parents:
diff changeset
   743
for being awesome.
31
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   744
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   745
Special thanks to Anne van Kesteren for his continuing work on the
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   746
WHATWG's <a href="http://notifications.spec.whatwg.org/">Notifications
d0d29cfd8c51 Sync with WHATWG document (through affe5ff).
Edward O'Connor <eoconnor@apple.com>
parents: 30
diff changeset
   747
API Standard</a>.