index.html 40.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027
<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html lang="en" dir="ltr"    >
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Web Notifications</title>
    
    
  <style type="text/css">
/*
    XXX this is not up to date with the needs of various other parts, it will require
        to be synched up with the latest developments
        It may be that this will be split up so that only the parts that are acually used
        by the document get to be included (e.g. WebIDL).
*/

/*****************************************************************
 * ReSpec 2 CSS
 * Robin Berjon, 2010-01-04
 *****************************************************************/

/* --- INLINES --- */
em.rfc2119 { 
    text-transform:     lowercase;
    font-variant:       small-caps;
    font-style:         normal;
    color:              #900;
}

h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
    border: none;
}

dfn {
    font-weight:    bold;
}

a.internalDFN {
    color:  inherit;
    border-bottom:  medium solid #99c;
    text-decoration:    none;
}

a.externalDFN {
    color:  inherit;
    border-bottom:  medium dotted #ccc;
    text-decoration:    none;
}

a.bibref {
    text-decoration:    none;
}

code {
    color:  #ff4500;
}


/* --- WEB IDL --- */
pre.idl {
    border-top: 1px solid #90b8de;
    border-bottom: 1px solid #90b8de;
    padding:    1em;
    line-height:    120%;
}

pre.idl::before {
    content:    "WebIDL";
    display:    block;
    width:      150px;
    background: #90b8de;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

.idlType {
    color:  #ff4500;
    font-weight:    bold;
    text-decoration:    none;
}

/*.idlModule*/
/*.idlModuleID*/
/*.idlInterface*/
.idlInterfaceID {
    font-weight:    bold;
    color:  #005a9c;
}

.idlSuperclass {
    font-style: italic;
    color:  #005a9c;
}

/*.idlAttribute*/
.idlAttrType {
    color:  #005a9c;
}
.idlAttrName {
    color:  #ff4500;
}
.idlAttrName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlMethod*/
.idlMethType {
    color:  #005a9c;
}
.idlMethName {
    color:  #ff4500;
}
.idlMethName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlParam*/
.idlParamType {
    color:  #005a9c;
}
.idlParamName {
    font-style: italic;
}

.extAttr {
    color:  #666;
}

/*.idlConst*/
.idlConstType {
    color:  #005a9c;
}
.idlConstName {
    color:  #ff4500;
}
.idlConstName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlException*/
.idlExceptionID {
    font-weight:    bold;
    color:  #c00;
}

.idlTypedefID, .idlTypedefType {
    color:  #005a9c;
}

.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
    color:  #c00;
    font-weight:    normal;
}

.excName a {
    font-family:    monospace;
}

.idlRaises a.idlType, .excName a.idlType {
    border-bottom:  1px dotted #c00;
}

.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
    width:  45px;
    text-align: center;
}
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }

.idlImplements a {
    font-weight:    bold;
}

dl.attributes, dl.methods, dl.constants {
    margin-left:    2em;
}

.attributes dt, .methods dt, .constants dt {
    font-weight:    normal;
}

.attributes dt code, .methods dt code, .constants dt code {
    font-weight:    bold;
    color:  #000;
    font-family:    monospace;
}

.attributes dt code {
    background:  #ffffd2;
}

.attributes dt .idlAttrType code {
    color:  #005a9c;
    background:  transparent;
    font-family:    inherit;
    font-weight:    normal;
    font-style: italic;
}

.methods dt code {
    background:  #d9e6f8;
}

.constants dt code {
    background:  #ddffd2;
}

.attributes dd, .methods dd, .constants dd {
    margin-bottom:  1em;
}

table.parameters, table.exceptions {
    border-spacing: 0;
    border-collapse:    collapse;
    margin: 0.5em 0;
    width:  100%;
}
table.parameters { border-bottom:  1px solid #90b8de; }
table.exceptions { border-bottom:  1px solid #deb890; }

.parameters th, .exceptions th {
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
    font-family:    initial;
    font-weight:    normal;
    text-shadow:    #666 1px 1px 0;
}
.parameters th { background: #90b8de; }
.exceptions th { background: #deb890; }

.parameters td, .exceptions td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
    vertical-align: top;
}

.parameters tr:first-child td, .exceptions tr:first-child td {
    border-top: none;
}

.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
    width:  100px;
}

.parameters td.prmType {
    width:  120px;
}

table.exceptions table {
    border-spacing: 0;
    border-collapse:    collapse;
    width:  100%;
}

/* --- TOC --- */
.toc a {
    text-decoration:    none;
}

a .secno {
    color:  #000;
}

/* --- TABLE --- */
table.simple {
    border-spacing: 0;
    border-collapse:    collapse;
    border-bottom:  3px solid #005a9c;
}

.simple th {
    background: #005a9c;
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
}

.simple th[scope="row"] {
    background: inherit;
    color:  inherit;
    border-top: 1px solid #ddd;
}

.simple td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
}

.simple tr:nth-child(even) {
    background: #f0f6ff;
}

/* --- DL --- */
.section dd > p:first-child {
    margin-top: 0;
}

.section dd > p:last-child {
    margin-bottom: 0;
}

.section dd {
    margin-bottom:  1em;
}

.section dl.attrs dd, .section dl.eldef dd {
    margin-bottom:  0;
}

/* --- EXAMPLES --- */
pre.example {
    border-top: 1px solid #ff4500;
    border-bottom: 1px solid #ff4500;
    padding:    1em;
    margin-top: 1em;
}

pre.example::before {
    content:    "Example";
    display:    block;
    width:      150px;
    background: #ff4500;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

/* --- EDITORIAL NOTES --- */
.issue {
    padding:    1em;
    border: 1px solid #f00;
    background: #ffc;
}

.issue::before {
    content:    "Issue";
    display:    block;
    width:  150px;
    margin: -1.5em 0 0.5em 0;
    font-weight:    bold;
    border: 1px solid #f00;
    background: #fff;
    padding:    3px 1em;
}

.note {
    padding:    1em;
    border: 2px solid #cff6d9;
    background: #e2fff0;
}

.note::before {
    content:    "Note";
    display:    block;
    width:  150px;
    margin: -1.5em 0 0.5em 0;
    font-weight:    bold;
    border: 1px solid #cff6d9;
    background: #fff;
    padding:    3px 1em;
}


/* --- SYNTAX HIGHLIGHTING --- */
/* Pretty printing styles. Used with prettify.js. */
.str { color: #080; }
.kwd { color: #008; }
.com { color: #800; }
.typ { color: #606; }
.lit { color: #066; }
.pun { color: #660; }
.pln { color: #000; }
.tag { color: #008; }
.atn { color: #606; }
.atv { color: #080; }
.dec { color: #606; }
pre.prettyprint { padding: 2px; border: 1px solid #888 }

/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */
li.L0, li.L1, li.L2, li.L3, li.L5, li.L6, li.L7, li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1, li.L3, li.L5, li.L7, li.L9 { background: #eee }

@media print {
  .str { color: #060; }
  .kwd { color: #006; font-weight: bold; }
  .com { color: #600; font-style: italic; }
  .typ { color: #404; font-weight: bold; }
  .lit { color: #044; }
  .pun { color: #440; }
  .pln { color: #000; }
  .tag { color: #006; font-weight: bold; }
  .atn { color: #404; }
  .atv { color: #060; }
}
</style><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" type="text/css" media="all" charset="utf-8">
  <body><div class="head">
    <p>
    
      <a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a>
    
    
    </p>
    <h1 class="title" id="title" >Web Notifications</h1>
    
    <h2 id="w3c-working-draft-01-march-2011"><acronym title="World Wide Web Consortium">W3C</acronym> Working Draft 01 March 2011</h2>
    <dl>
      
        <dt>This Version:</dt><dd>   <a href="http://www.w3.org/TR/2011/WD-notifications-20110301/">http://www.w3.org/TR/2011/WD-notifications-20110301/</a></dd>
        <dt>Latest Published Version:</dt><dd>   <a href="http://www.w3.org/TR/notifications/">http://www.w3.org/TR/notifications/</a></dd>
        
          <dt>Latest Editor's Draft:</dt><dd>
   <a href="http://dev.w3.org/2006/webapi/WebNotifications/publish/Notifications.html">http://dev.w3.org/2006/webapi/WebNotifications/publish/Notifications.html</a></dd>
        
      
      
        
      
      
      
  
    <dt>Editor:</dt>
    
      <dd class="Editor"><span ><span class="name" >John Gregg</span>, 
          
            <a class="company" href="http://www.google.com/" rel="foaf:workplaceHomepage">Google</a>
          
        
         &lt;<a class="email" href="mailto:johnnyg@google.com" rel="foaf:mbox">johnnyg@google.com</a>&gt;
        
      </span></dd>
    
  

      
  

    </dl>
    
    
  

    
    <p class="copyright">
    
      <a class="license" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" rel="license">Copyright</a> © 
      2011
      
      <span><a class="publisher" href="http://www.w3.org/"><acronym title="World Wide Web Consortium"><acronym title="World Wide Web Consortium">W3C</acronym></acronym></a></span><sup>®</sup>
      (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology"><acronym title="Massachusetts Institute of Technology">MIT</acronym></acronym></a>,
      <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></acronym></a>,
      <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
      <acronym title="World Wide Web Consortium">W3C</acronym> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
      <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
      <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
    
    </p><hr></div>

  <div id="abstract" class="introductory section"    ><h2>Abstract</h2>
    <p>
      This document defines an API for displaying simple notifications to the user.
    </p>
  </div><div id="sotd" class="introductory section"  >
      <h2>Status of This Document</h2>
      <p><em>This section describes the status of this document at the time of its publication. Other 
      documents may supersede this document. A list of current <acronym title="World Wide Web Consortium">W3C</acronym> publications and the latest revision 
      of this technical report can be found in the <a href="http://www.w3.org/TR/"><acronym title="World Wide Web Consortium">W3C</acronym> technical reports 
      index</a> at http://www.w3.org/TR/.</em></p>
      
      <p>
        This document was published by the <a href="http://www.w3.org/2010/web-notifications/">Web Notification Working Group</a> as 
        a
        First Public Working Draft.
         This document is intended to become a <acronym title="World Wide Web Consortium">W3C</acronym> Recommendation.
        If you wish to make comments regarding this document, please send them to 
        <a href="mailto:public-web-notification@w3.org">public-web-notification@w3.org</a> 
        (<a href="mailto:public-web-notification-request@w3.org?subject=subscribe">subscribe</a>,
        <a href="http://lists.w3.org/Archives/Public/public-web-notification/">archives</a>).
        
        
        All feedback is welcome.
      </p>
      
        <p>
          Publication as a Working Draft does not imply endorsement by the <acronym title="World Wide Web Consortium">W3C</acronym> Membership. This is a draft 
          document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate
          to cite this document as other than work in progress.
        </p>
      

<p>Although this is an initial draft and the group is open to changing the design,
the group has so far not received feedback asking it to do so.</p>
      
      <p>
        This document was produced by a group operating under the 
        <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.
        
        <acronym title="World Wide Web Consortium">W3C</acronym> maintains a <a href="http://www.w3.org/2004/01/pp-impl/45313/status" rel="disclosure">public list of any patent disclosures</a> 
        made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An
        individual who has actual knowledge of a patent which the individual believes contains 
        <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the
        information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 
        6 of the <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.
      </p>
    </div><div id="toc"   class="section"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#definitions" class="tocxref"><span class="secno">1. </span>Definitions</a></li><li class="tocline"><a href="#requirements" class="tocxref"><span class="secno">2. </span>Requirements and use cases</a></li><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">3. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#security" class="tocxref"><span class="secno">3.1 </span>Security</a></li></ul></li><li class="tocline"><a href="#permissions" class="tocxref"><span class="secno">4. </span>Permissions</a></li><li class="tocline"><a href="#idl-if-Notification" class="tocxref"><span class="secno">5. </span>The Notification interface</a><ul class="toc"><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">5.1 </span>Methods</a></li><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">5.2 </span>Attributes</a></li><li class="tocline"><a href="#directionality" class="tocxref"><span class="secno">5.3 </span>Directionality</a></li><li class="tocline"><a href="#event-handler-attributes" class="tocxref"><span class="secno">5.4 </span>Event handler attributes</a></li>
<li class="tocline"><a href="#notification-constructor" class="tocxref"><span class="secno">5.5 </span>Constructor</a></li>
</ul></li><li class="tocline"><a href="#algorithms" class="tocxref"><span class="secno">6. </span>Queueing and displaying notifications</a><ul class="toc"><li class="tocline"><a href="#queueing-notifications" class="tocxref"><span class="secno">6.1 </span>Queueing notifications</a></li><li class="tocline"><a href="#displaying" class="tocxref"><span class="secno">6.2 </span>Displaying notifications</a></li><li class="tocline"><a href="#replacing" class="tocxref"><span class="secno">6.3 </span>Replacing a notification</a></li></ul></li><li class="tocline"><a href="#interactions" class="tocxref"><span class="secno">7. </span>Interacting with notifications</a><ul class="toc"><li class="tocline"><a href="#using-events" class="tocxref"><span class="secno">7.1 </span>Using events</a></li></ul></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">A.1 </span>Normative references</a></li></ul></li></ul></div>

  <div id="definitions"   class="section"><!--OddPage--><h2><span class="secno">1. </span>Definitions</h2>
    

    <ul>
      <li><em>ambient notification</em>: A notification which appears and disappears automatically without user action.</li>
      <li><em>interactive notification</em>: A notification which can receive events from user actions and deliver them to the application which created the notification.</li>
      <li><em>persistent notification</em>: A notification which is displayed until the user explicitly dismisses it.</li>
      <li><em>notification platform</em>: A notification platform is a system outside the user agent which provides desktop notifications.  Examples include Growl on MacOS, NotifyOSD on Linux, and the Windows notification API.</li>
      <li><em>simple notification</em>: A notification which consists only of an icon and one or two lines of text.</li>
      <li><em>web notification</em>: A notification which consists of Web platform content, such as HTML or SVG.</li>
    </ul>
  </div>

  <div id="requirements"   class="section"><!--OddPage--><h2><span class="secno">2. </span>Requirements and use cases</h2>
      
    This specification must meet the following requirements:
    <ul>
      <li>An implementation which uses only the existing notification platforms in major platforms to display notifications must be able to comply with the specification.</li>
      <li>The specification must allow compliant implementations regardless of platform or device.</li>
      <li>The specification must provide controls to users in order to prevent unwanted notifications to be displayed.</li>
      <li>The specification must define an event model for interactive notifications.</li>
      <li>The specification must address security issues.</li>
      <li>The specification should not require any implementation to display persistent notifications.</li>
      <li>The specification should be compatible with other Web technologies, such as HTML and SVG.</li>
    </ul>

    The specification attempts to address the following use cases:
    <ul>
      <li>An application alerts the user "you've got mail" in the form of an ambient notification, with no interaction necessary.</li>
      <li>An application alerts the user "you've got mail" as an interactive notification which allows the user to easily return to the inbox.</li>
      <li>A calendar application alerts the user for an upcoming meeting, and allows the user to easily specify a "snooze" delay of several possible time periods.</li>
      <li>A system alerts the user "your printer is out of paper".</li>
      <li>An application with multiple simultaneous execution contexts (like a multi-tab email application) wants to show notifications without creating duplicate notifications.</li>
    </ul>
  </div>
  
  <div id="introduction" class="informative section"  ><!--OddPage--><h2><span class="secno">3. </span>Introduction</h2><em>This section is non-normative.</em>
    
    <p>
      This specification provides an API to generate <em>simple notifications</em> to
      alert users outside of the web page.  It does not specify exactly how a user
      agent should display these notifications; the best presentation depends on the device
      where the user agent is run.  When this specificiation refers to displaying
      notifications on the "desktop", it generally refers to some static display
      area outside the web page, but may take several forms, including:
      </p><ul>
        <li>a corner of the user's display,</li>
        <li>an area within the chrome of the user agent,</li>
        <li>the "home" screen of a mobile device,</li>
        <li><em>et al.</em></li>
      </ul>
      This specification does not define exactly how the user agent should display
      the notification, and the API is designed to be flexible with respect to
      presentation options.
    <p></p>
    <p>
      This specification is designed to be compatible with existing notification platforms
      as much as possible, but also to be platform-independent.  Since the common platforms
      do not provide the same functionality, this spec will indicate what events are guaranteed
      and which are not.  In particular, notifications as specified here only can contain
      text and icon content.  In the future, notifications generated from Web content may
      wish to contain Web content themselves, but that is outside the scope of this document.
    </p>    
    <p>
      In general, the event model for notifications is best-effort; while the Notification 
      object offers an "onclick" event, applications may enhance their functionality by
      listening for that event, but <em>must not depend on receiving it</em>,
      in case the underlying notification platform does not provide that capability.
    </p>
   
    <div class="section" id="security"  ><h3><span class="secno">3.1 </span>Security</h3><em>This section is non-normative.</em>
      
      <p>
	Notifications should only be presented when the user has indicated they are desired;
	without this they could create a negative experience for the user.
      </p>     
      </div>
  </div>

  <div id="permissions"   class="section"><!--OddPage--><h2><span class="secno">4. </span>Permissions</h2>
    
    <p>
      Permissions for notifications must be controlled using the Feature Permissions interface
      where Notifications are a privileged feature with unique id 'notifications'. [<cite><a class="bibref" rel="biblioentry" href="#bib-PERMISSIONS">PERMISSIONS</a></cite>]
    </p>

    <p>
      Throughout this document, "notification permission is allowed" shall mean that 
      the permission level of the 'notifications' feature for the current
      security origin is <code>USER_ALLOWED</code>  or <code>DEFAULT_ALLOWED</code>
      in the meaning of [<cite><a class="bibref" rel="biblioentry" href="#bib-PERMISSIONS">PERMISSIONS</a></cite>], and "notification permission is denied" shall mean 
      that the current permission level has some other value.
    </p>
  </div>

  <div id="idl-if-Notification"   class="section"><!--OddPage--><h2><span class="secno">5. </span>The Notification interface</h2>
    <p>
      The Notification interface represents a single notification to be shown to the user. It extends the EventTarget interface defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-DOM-LEVEL-3-EVENTS">DOM-LEVEL-3-EVENTS</a></cite>].
    </p>
    <pre class="idl"><span class="idlInterface" id="idl-def-Notification">[<a href="#notification-constructor"><span class="extAttr">Constructor</span></a>]
interface <span class="idlInterfaceID">Notification</span> : <span class="idlSuperclass"><a>EventTarget</a></span> {
<span class="idlMethod">    <span class="idlMethType"><span><a>void</a></span></span>         <span class="idlMethName"><a href="#widl-Notification-show">show</a></span> ();
</span><span class="idlMethod">    <span class="idlMethType"><span><a>void</a></span></span>         <span class="idlMethName"><a href="#widl-Notification-cancel">cancel</a></span> ();
</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><span><a>Function</a></span></span> <span class="idlAttrName"><a href="#widl-Notification-onclick">onclick</a></span>;
</span><span class="idlAttribute">    attribute <span class="idlAttrType"><span><a>Function</a></span></span> <span class="idlAttrName"><a href="#widl-Notification-onshow">onshow</a></span>;
</span><span class="idlAttribute">    attribute <span class="idlAttrType"><span><a>Function</a></span></span> <span class="idlAttrName"><a href="#widl-Notification-onerror">onerror</a></span>;
</span><span class="idlAttribute">    attribute <span class="idlAttrType"><span><a>Function</a></span></span> <span class="idlAttrName"><a href="#widl-Notification-onclose">onclose</a></span>;
</span><span class="idlAttribute">    attribute <span class="idlAttrType"><span><a>DOMString</a></span></span> <span class="idlAttrName"><a href="#widl-Notification-replaceId">replaceId</a></span>;
</span><span class="idlAttribute">    attribute <span class="idlAttrType"><span><a>DOMString</a></span></span> <span class="idlAttrName"><a href="#widl-Notification-dir">dir</a></span>;
</span>};
</span></pre>

<div class="section" id="methods"  ><h3><span class="secno">5.1 </span>Methods</h3>
<dl>
<dt id="widl-Notification-cancel">
  <code>cancel</code>
</dt>
<dd>
  
	      <p>
	        Requests the user agent to not show this notification. If the notification
	        has already been displayed, the user agent must remove it from the display;
	        if it has not yet be displayed, the user agent must prevent its being
	        displayed.
	      </p>
        
  
  <div><em>No Parameters.</em></div>
  
  
  <div><em>No exceptions.</em></div>
  
  <div>
    <em>Return type:</em> <code>void</code>
  </div>
</dd><dt id="widl-Notification-show">
  <code>show</code>
</dt>
<dd>
  
	      <p>
	        Requests the user agent to show the notification to the user. Depending on 
	        desktop space, user idleness, or other factors as determined by the user
	        agent, this may happen immediately or be postponed, but must eventually
	        be done, following the algorithm for queueing a notification below.
	      </p>
	      <p>
	        A user agent must not show any notifications if notification permission is denied.
	        If notification permission is denied when <code>show()</code> is invoked, 
	        an <code>error</code> event must be fired on this notification object.
	      </p>
        
  
  <div><em>No Parameters.</em></div>
  
  
  <div><em>No exceptions.</em></div>
  
  <div>
    <em>Return type:</em> <code>void</code>
  </div>
</dd></dl></div><div class="section" id="attributes"  ><h3><span class="secno">5.2 </span>Attributes</h3><dl><dt id="widl-Notification-dir">
  <code>dir</code>
  of type
  
  <span class="idlAttrType">DOMString</span>
</dt>
<dd>
  
	      <p>
	        The <code>dir</code> attribute specifies the directionality of the notification.
	      </p>
        
  
    <div><em>No exceptions.</em></div>
  
</dd><dt id="widl-Notification-onclick">
  <code>onclick</code>
  of type
  
  <span class="idlAttrType">Function</span>
</dt>
<dd>
  
	      <p>
	        An event listener function corresponding to the event type "click".  This event
	        listener is must be invoked when the user clicks on a notification.
	      </p>
	      <p>
	        <em>
	        This event is not guaranteed if the underlying notification platform does not support receiving
	        click events.
	        </em>
	      </p>
        
  
    <div><em>No exceptions.</em></div>
  
</dd><dt id="widl-Notification-onclose">
  <code>onclose</code>
  of type
  
  <span class="idlAttrType">Function</span>
</dt>
<dd>
  
	      <p>
	        An event listener function corresponding to the event type "close".  This
	        event listener must be invoked after the "show" event, at the point
	        when the notification is dismissed by the user, closed by script, or closed by the notification
	        platform.
	      </p>
        
  
    <div><em>No exceptions.</em></div>
  
</dd><dt id="widl-Notification-onerror">
  <code>onerror</code>
  of type
  
  <span class="idlAttrType">Function</span>
</dt>
<dd>
  
	      <p>
	        An event listener function corresponding to the event type "error".  This
	        event listener must be invoked after the <code>show()</code> method is called, if the
	        notification cannot be displayed to the user because of an error.
	      </p>
        
  
    <div><em>No exceptions.</em></div>
  
</dd><dt id="widl-Notification-onshow">
  <code>onshow</code>
  of type
  
  <span class="idlAttrType">Function</span>
</dt>
<dd>
  
	      <p>
	        An event listener function corresponding to the event type "show".  This
	        event listener must be invoked after the <code>show()</code> method is called, at the
	        point when the notification actually becomes visible to the user.
	      </p>
	      <p>
	        <em>
	        If the underlying notification platform does not show the notification immediately,
	        this event may precede the notification becoming visible; however the notification
	        will never become visible before this event is dispatched.
	        </em>
	      </p>
        
  
    <div><em>No exceptions.</em></div>
  
</dd><dt id="widl-Notification-replaceId">
  <code>replaceId</code>
  of type
  
  <span class="idlAttrType">DOMString</span>
</dt>
<dd>
  
	      <p>
	        A value which identifies this notification for replacement by another notification
	        serving the same purpose.  The user agent should not allow two notifications created
	        by the same security origin and having the same <code>replaceId</code> value to be 
	        shown simultaneously.
	      </p>
        
  
    <div><em>No exceptions.</em></div>
  
</dd></dl></div>
    
    <div class="section" id="directionality"  ><h3><span class="secno">5.3 </span>Directionality</h3>
      
      <p>
	The <code>dir</code> attribute of the <code>Notification</code> interface has
	has all the properties of the <code>dir</code> attribute as defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>], however
	since the notification does not have a parent element, it must receive a default
	value elsewhere, as follows.
      </p>
      <p>
        In environments where the global object is represented by the <code>Window</code>
	object, if the notification's directionality state is not <em>ltr</em> or <em>rtl</em>,
	the directionality must be the same as	the <code>Document</code> object associated
	with the global <code>Window</code> object.

	In other environments, if the notification's directionality state is not <em>ltr</em> or <em>rtl</em>,
	the directionality should be <em>ltr</em>.
      </p>
    </div>

    
    <div class="section" id="event-handler-attributes"  ><h3><span class="secno">5.4 </span>Event handler attributes</h3>
      
      <p>The following are event handler attributes (and their corresponding event handler event types, as defined by
       [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>]) that must be supported as DOM attributes by the Notification object.</p>
      <table>
	<thead style="border-bottom: medium solid;">
	  <tr>
	    <th>event handler attribute</th>
	    <th>event handler event type</th>
	  </tr>
	</thead>
	<tbody><tr>
	  <td><code>onclick</code></td>
	  <td><code>click</code></td>
	</tr>
	<tr>
	  <td><code>onshow</code></td>
	  <td><code>show</code></td>
	</tr>
	<tr>
	  <td><code>onerror</code></td>
	  <td><code>error</code></td>
	</tr>
	<tr>
	  <td><code>onclose</code></td>
	  <td><code>close</code></td>
	</tr>
      </tbody></table>
    </div>
   
<div class="section" id="notification-constructor">
<h3><span class="secno">5.5 </span>Constructor</h3>
    <pre class="idl"><span class="idlMethod">    <span class="idlMethType"><span><a href="#idl-def-Notification" class="idlType"><code>Notification</code></a></span></span> <span class="idlMethName">Notification</span> (<span class="idlParam"> in <span class="idlParamType"><span><a>DOMString</a></span></span> <span class="idlParamName">iconUrl</span></span>, <span class="idlParam"> in <span class="idlParamType"><span><a>DOMString</a></span></span> <span class="idlParamName">title</span></span>, <span class="idlParam"> in <span class="idlParamType"><span><a>DOMString</a></span></span> <span class="idlParamName">body</span></span>);</span></pre>
<dl>
<dt></dt>
<dd>
  
          <p>Returns a new simple notification object with the provided content.</p>
          
  <table class="parameters">
    <tbody><tr><th>Parameter</th><th>Type</th><th>Description</th>
    
    </tr><tr>
      <td class="prmName">iconUrl</td>
      <td class="prmType"><code>DOMString</code></td>
      
      
      <td class="prmDesc">
	             URL of the icon to be shown with this notification.
	             The parameter must be resolved relative to the current document base URL or worker script URL.
              </td>
    </tr>
    
    <tr>
      <td class="prmName">title</td>
      <td class="prmType"><code>DOMString</code></td>
      
      
      <td class="prmDesc">
	            Primary text, or title, of the notification.  The user agent may ignore any markup in this string and treat it as plain text.
              </td>
    </tr>
    
    <tr>
      <td class="prmName">body</td>
      <td class="prmType"><code>DOMString</code></td>
      
      <td class="prmDesc">
	            Secondary text, or body, of the notification.  The user agent may ignore any markup in this string and treat it as plain text.
              </td>
    </tr>
    
  </tbody></table>
  
  <div><em>No exceptions.</em></div>
  
</dd>
</dl>
          <p>
          When the <code>Notification()</code> constructor is invoked, the user agent must return a new Notification object.
          </p>
</div>
  </div>

  <div id="algorithms"   class="section"><!--OddPage--><h2><span class="secno">6. </span>Queueing and displaying notifications</h2>
    
    <div class="section" id="queueing-notifications"  ><h3><span class="secno">6.1 </span>Queueing notifications</h3>
      
      <p>
	If the device allows notifications to displayed immediately without limitations on
	the number of concurrent notifications, it must display a notification immediately
	whenever <code>show</code> is called and notification permission is allowed.
      </p>

      <p>
	If the device does have limitations on the number of concurrent notifications,
	when <code>show</code> is called and notification permission is allowed,
	the user agent must either immediately call to a notifications platform which 
	supports queueing, or use the following algorithm.
      </p>
      <p>
	The user agent must keep a <em>queue of pending notifications</em> and a <em>list of active notifications</em>. 
      </p>
      <ol>
	<li>Get the replacement id of the notification to be shown, and let it be replaceId.</li>
	<li>
	  If replaceId is defined, examine all the notifications in the <em>list of active notifications</em>.
	  If any notification in the list has the same source origin and has replacement id equal to replaceId,
	  do the following steps and then terminate this algorithm.  Let <em>existing</em> be the notification in the list
	  which matches.
	  <ol>
	    <li>Replace <em>existing</em> with the new notification using the <a href="#replacing" class="sec-ref">replacing a notification</a> algorithm.</li>
	    <li>If the replacement returned error information, stop.</li>
	    <li>Remove <em>existing</em> from the <em>list of active notifications</em>.</li>
	    <li>Add the new notification to the <em>list of active notifications</em>.</li>
  </ol>
	</li>
	<li>Add the notification to the <em>queue of pending notifications</em>.</li>
	<li>Wait until there is available space on the device.</li>
	<li>Display the first notification in the <em>queue of pending notifications</em> using 
	  the <a href="#displaying" class="sec-ref">displaying a notification</a> algorithm.</li>
      </ol>
      <p>
	When the available display space changes on the device such that a new notification may be
	displayed, for example due to a previous notification being dismissed, the user agent should
	<a href="#displaying" class="sec-ref">display</a> the first notification in the queue using the procedure described above.
      </p>
    </div>

    <div class="section" id="displaying"  ><h3><span class="secno">6.2 </span>Displaying notifications</h3>
      
      <p>
	When a user agent is to <em>display a notification</em>, the user agent should perform the following steps:
	</p><ol>
	  <li>
	    Fetch the resource given by <code>iconUrl</code> using the algorithm defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>].
	  </li>
	  <li>
	    If the fetch algorithm returns error information, fire the <code>error</code> event on the notification
	    object and stop executing this algorithm.
	  </li>
	  <li>Fire the <code>show</code> event on the notification object.</li>
	  <li>Show the notification on the device, such as by calling the appropriate notification platform.</li>
	</ol>
      <p></p>
    </div>

    <div class="section" id="replacing"  ><h3><span class="secno">6.3 </span>Replacing a notification</h3>
      
      <p>
	When a user agent is to <em>replace a notification</em>, the user agent should perform the following steps.
	Let <em>old</em> be the notification to be replaced by <em>new</em>.
	</p><ol>
	  <li>
	    Fetch the icon resource in <em>new</em> using the algorithm defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>].
	  </li>
	  <li>
	    If the fetch algorithm returns error information, fire the <code>error</code> event on the <em>new</em> notification
	    object and stop executing this algorithm, returning the error information.  The <em>old</em> notification is not affected.
	  </li>
	  <li>Fire the <code>close</code> event on the <em>old</em> notification object.</li>
	  <li>Fire the <code>show</code> event on the <em>new</em> notification object.</li>
	  <li>If the underlying notification platform supports replacement, replace <em>old</em> with <em>new</em> on the device.</li>
	  <li>If the underlying notification platform does not support replacment, remove <em>old</em> from the device and show <em>new</em> on the device.</li>
	</ol>
      <p></p>
    </div>
  </div>
  <div id="interactions" class="informative section"  ><!--OddPage--><h2><span class="secno">7. </span>Interacting with notifications</h2><em>This section is non-normative.</em>
    
    <div class="section" id="using-events"  ><h3><span class="secno">7.1 </span>Using events</h3><em>This section is non-normative.</em>
      
      <p>
	Notification objects dispatch events during their lifecycle, which authors can use
	to generate desired behaviors.
      </p>
      <p>
	The <code>show</code> event occurs when the notification is shown to the user -- 
	this may be at some time after the <code>show()</code> method is called in the case
	of limited display space and a queue.
      </p>

      <p>
	In the following example, this event is used to guarantee that regardless of when
	the notification is shown, it is displayed for only 15 seconds.
      </p>

      <pre class="example" title="">var notification = new Notification("mail.png", "New Email Received");
notification.onshow = function() { setTimeout(notification.cancel(), 15000); }
notification.show();</pre>

      <p>
	The <code>close</code> events occurs when the notification is dismissed by the user.
	Authors may use this event to perform actions when notifications are acknowledged.
      </p>
      <p>
	In the following example, when a meeting reminder notification is acknowledged, the
	application suppresses other forms of reminders.
      </p>

      <pre class="example" title="">var notification = new Notification("calendar.png", "Meeting about to begin", "Room 101");
notification.onclose = function() { cancelReminders(event); }
notification.show();</pre>
    </div>
  </div>


<div id="references" class="appendix section"  ><!--OddPage--><h2><span class="secno">A. </span>References</h2><div class="section" id="normative-references"  ><h3><span class="secno">A.1 </span>Normative references</h3><dl class="bibliography" ><dt id="bib-DOM-LEVEL-3-EVENTS">[DOM-LEVEL-3-EVENTS]</dt><dd >Doug Schepers; Björn Höhrmann; Tom Pixley; Philippe Le Hégaret. <a href="http://www.w3.org/TR/2010/WD-DOM-Level-3-Events-20100907"><cite>Document Object Model (DOM) Level 3 Events Specification.</cite></a> 07 September 2010. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2010/WD-DOM-Level-3-Events-20100907">http://www.w3.org/TR/2010/WD-DOM-Level-3-Events-20100907</a></dd><dt id="bib-HTML5">[HTML5]</dt><dd >Ian Hickson. <a href="http://dev.w3.org/html5/spec/"><cite>HTML5.</cite></a> Editor’s Draft. (Work in progress.) URL: <a href="http://dev.w3.org/html5/spec/">http://dev.w3.org/html5/spec/</a> </dd><dt id="bib-PERMISSIONS">[PERMISSIONS]</dt><dd >John Gregg. <a href="http://dev.w3.org/2006/webapi/WebNotifications/publish/FeaturePermissions.html"><cite>Feature Permissions.</cite></a> 12 October 2010. Editor’s Draft. (Work in progress.) URL: <a href="http://dev.w3.org/2006/webapi/WebNotifications/publish/FeaturePermissions.html">http://dev.w3.org/2006/webapi/WebNotifications/publish/FeaturePermissions.html</a></dd></dl></div></div></body></html>