forked from w3c/manifest
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
3358 lines (3351 loc) · 136 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
Web Application Manifest
</title>
<script src="https://www.w3.org/Tools/respec/respec-w3c" class=
"remove"></script>
<script class='remove'>
var respecConfig = {
mdn: true,
previousPublishDate: "2013-12-17",
specStatus: "ED",
shortName: "appmanifest",
prevVersion: "FPWD",
previousMaturity: "WD",
formerEditors: [
{
name: "Mounir Lamouri",
company: "Google Inc.",
companyURL: "https://www.google.com/",
},
{
name: "Rob Dolin",
company: "Microsoft Corporation",
companyURL: "https://www.microsoft.com/",
},
],
editors: [
{
name: "Marcos Cáceres",
company: "Apple",
companyURL: "https://apple.com",
w3cid: 39125,
},
{
name: "Kenneth Rohde Christiansen",
company: "Intel Corporation",
companyURL: "https://intel.com/",
w3cid: 57705,
},
{
name: "Matt Giuca",
company: "Google Inc.",
companyURL: "https://www.google.com/",
w3cid: 91260,
},
{
name: "Aaron Gustafson",
company: "Microsoft Corporation",
companyURL: "https://microsoft.com/",
w3cid: 43672,
},
{
name: "Daniel Murphy",
company: "Google Inc.",
companyURL: "https://www.google.com/",
w3cid: 90918,
},
{
name: "Anssi Kostiainen",
company: "Intel Corporation",
companyURL: "https://intel.com/",
w3cid: 41974,
},
],
group: "webapps",
github: "https://github.com/w3c/manifest/",
caniuse: {
versions: 1,
feature: "web-app-manifest",
browsers: [
"chrome",
"and_chr",
"edge",
"and_ff",
"ios_saf",
],
},
xref: "web-platform",
};
</script>
<style>
.icon-title {
text-transform: uppercase;
font-weight: bold;
}
.icons {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.icons > figure {
text-align: left;
margin: 0;
padding: 10px;
width: 188px;
}
.icons > figure > img {
width: 188px;
height: 188px;
min-width: 188px;
min-height: 188px;
}
.icons > figure .icon-title {
display: block;
}
</style>
</head>
<body data-cite=
"ENCODING SCREEN-ORIENTATION MEDIAQUERIES-5 IMAGE-RESOURCE MIMESNIFF">
<section id='abstract'>
<p>
This specification defines a JSON-based file format that provides
developers with a centralized place to put metadata associated with a
web application. This metadata includes, but is not limited to, the web
application's name, links to icons, as well as the preferred URL to
open when a user launches the web application. The manifest also allows
developers to declare a default screen orientation for their web
application, as well as providing the ability to set the display mode
for the application (e.g., in fullscreen). Additionally, the manifest
allows a developer to "scope" a web application to a URL. This
restricts the URLs to which the manifest is applied and provides a
means to "deep link" into a web application from other applications.
</p>
<p>
Using this metadata, user agents can provide developers with means to
create user experiences that are more comparable to that of a native
application.
</p>
</section>
<section id="sotd">
<aside class="warning">
<p>
Implementors need to be aware that this specification is not stable.
However, aspects of this specification are shipping in at least one
browser (see links to implementation status at the top of this
document). <strong>Implementors who are not taking part in the
discussions will find the specification changing out from under them
in incompatible ways.</strong> Vendors interested in implementing
this specification before it eventually reaches the Candidate
Recommendation phase should <a href=
"https://github.com/w3c/manifest/issues">subscribe to the repository
on GitHub</a> and take part in the discussions.
</p>
</aside>
</section>
<section>
<h2>
Web Application Manifest
</h2>
<p>
An <dfn data-export="" data-lt="manifest" data-local-lt=
"manifest's">application manifest</dfn> is a [[JSON]] document that
contains startup parameters and application defaults for when a web
application is launched.
</p>
<p>
A manifest has an associated <dfn class="export">manifest URL</dfn>,
which is the [[URL]] from which the <a>manifest</a> was fetched.
</p>
<p>
A [=manifest=] can have any of the following members at its root, all
of which are optional. The members can appear in any order.
</p>
<ul>
<li>[=manifest/background_color=]
</li>
<li>[=manifest/dir=]
</li>
<li>[=manifest/display=]
</li>
<li>[=manifest/icons=]
</li>
<li>[=manifest/identity=]
</li>
<li>[=manifest/lang=]
</li>
<li>[=manifest/name=]
</li>
<li>[=manifest/orientation=]
</li>
<li>[=manifest/prefer_related_applications=]
</li>
<li>[=manifest/related_applications=]
</li>
<li>[=manifest/scope=]
</li>
<li>[=manifest/short_name=]
</li>
<li>[=manifest/shortcuts=]
</li>
<li>[=manifest/start_url=]
</li>
<li>[=manifest/theme_color=]
</li>
</ul>
<aside class="note">
<p>
Although it is optional for any member to appear in a manifest, some
user agents might require one or more to be present to take full
advantage of the capabilities afforded by this specification.
</p>
</aside>
<section class="informative">
<h3>
Examples
</h3>
<p>
This section shows how developers can make use of the various
features of this specification.
</p>
<section class="informative">
<h3>
Typical structure
</h3>
<p>
The following shows a typical <a>manifest</a>.
</p>
<pre class="example json" title="Typical manifest">
{
"lang": "en",
"dir": "ltr",
"name": "Super Racer 3000",
"short_name": "Racer3K",
"icons": [{
"src": "icon/lowres.webp",
"sizes": "64x64",
"type": "image/webp"
}, {
"src": "icon/lowres.png",
"sizes": "64x64"
}, {
"src": "icon/hd_hi",
"sizes": "128x128"
}],
"scope": "/",
"id": "superracer",
"start_url": "/start.html",
"display": "fullscreen",
"orientation": "landscape",
"theme_color": "aliceblue",
"background_color": "red"
}
</pre>
</section>
<section class="informative">
<h3>
Using a `link` element to link to a manifest
</h3>
<p>
The example also shows how to use the link type "manifest" and how
to use other [^meta^] and [^link^] elements to give the web
application a fallback name and set of icons.
</p>
<pre class="example html" title="Linking to a manifest">
<!doctype>
<html>
<title>Racer 3K</title>
<!-- Startup configuration -->
<link rel="manifest" href="manifest.webmanifest">
<!-- Fallback application metadata for legacy browsers -->
<meta name="application-name" content="Racer3K">
<link rel="icon" sizes="16x16 32x32 48x48" href="lo_def.ico">
<link rel="icon" sizes="512x512" href="hi_def.png">
</pre>
<aside class="note" title="File extension: .webmanifest or .json?">
The IANA <a href=
"https://www.iana.org/assignments/media-types/application/manifest+json">
registered</a> file extension for the manifest is `.webmanifest`.
Some web servers recognize this extension and transfer the file
using the standardized <a>application manifest media type</a>
([=application\/manifest+json=]). Developers can also choose a
different extension (e.g. `.json`) or none at all (e.g.
`/api/GetManifest`), but are encouraged to transfer the manifest
using the [=application\/manifest+json=] [=MIME type=], although
any [=JSON MIME type=] is ok.
</aside>
</section>
<section class="informative">
<h3>
Declaring multiple icons
</h3>
<p>
In the following example, the developer has made the following
choices about the icons associated with the web application:
</p>
<ul>
<li>The developer has included two icons at the same size, but in
two different formats. One is explicitly marked as WebP through the
`type` member. If the user agent doesn't support WebP, it falls
back to the second icon of the same size. The <a>MIME type</a> of
this icon can then be either determined via a HTTP header, or can
be <a data-lt="computed mime type">sniffed</a> by the user agent
once the first few bytes of the icon are received.
</li>
<li>The developer wants to use an SVG for greater than or equal to
257x257px. They've found that the SVG file looks too blurry at
small sizes, even on high-density screens. To deal with this
problem, the developer includes an SVG icon that is only used when
the dimensions are at least 257px. Otherwise, the user agent uses
the ICO file (hd_hi.ico), which includes a gamut of raster icons
individually tailored for small display sizes.
</li>
</ul>
<pre class="example json" title="Multiple icons">
{
"icons": [
{
"src": "icon/lowres.webp",
"sizes": "48x48",
"type": "image/webp"
},{
"src": "icon/lowres",
"sizes": "48x48"
},{
"src": "icon/hd_hi.ico",
"sizes": "72x72 96x96 128x128 256x256"
},{
"src": "icon/hd_hi.svg",
"sizes": "257x257"
}]
}
</pre>
</section>
<section class="informative">
<h3>
Creating shortcuts
</h3>
<p>
In the following example, the developer has included two shortcuts.
Assuming the manifest's URL is
<samp>https://example.com/manifest.webmanifest</samp>:
</p>
<ul>
<li>The first shortcut would be displayed with the text "Play
Later". If the operating system supports icons for context menu
items and it also supports SVG images for that purpose, the user
agent would present
<samp>https://example.com/icons/play-later.svg</samp> next to the
text. When launched, the user agent would instantiate a new
<a>top-level browsing context</a> and navigate to
<samp>https://example.com/play-later</samp>.
</li>
<li>The second shortcut would be displayed with the text
"Subscriptions". When launched, the user agent would instantiate a
new <a>top-level browsing context</a> and navigate to
<samp>https://example.com/subscriptions?sort=desc</samp>.
</li>
</ul>
<pre class="example json" title="Adding shortcuts">
{
"shortcuts": [
{
"name": "Play Later",
"description": "View the list of podcasts you saved for later",
"url": "/play-later",
"icons": [
{
"src": "/icons/play-later.svg",
"type": "image/svg+xml"
}
]
},
{
"name": "Subscriptions",
"description": "View the list of podcasts you listen to",
"url": "/subscriptions?sort=desc"
}
]
}
</pre>
</section>
<section class="informative">
<h2>
Understanding "scope"
</h2>
<p>
The [=manifest/scope=] member tells the browser which documents are
part of a web application, and which are not - and hence, to which
set of web pages the manifest is "[=applied=]" when the user
navigates around a web site.
</p>
<p>
For example, `{"scope": "/"}` means that the manifest applies to
every document in an origin. On the other hand, `{"scope":
"/racer/"}` means that only documents within the path "/racer/" are
[=URL/within scope=]: so "/racer/race1.html", "/racer/race2.html",
etc. would all be [=URL/within scope=], but "/elsewhere/" and
anything at the root "/" would be "out of scope" and the manifest
wouldn't apply to documents in those paths. Only one scope path is
supported. See [[[#nav-scope]]] for the technical details.
</p>
<p>
[=Applying=] a manifest means that any members that affect
presentation found in the manifest will come into effect, such as
display "fullscreen", or applying a particular screen orientation.
As long as the application is navigated to URLs that are
[=URL/within scope=], the browser will continue to apply the
manifest. However, navigating the web applications "out of scope"
will cause the manifest to no longer be applied, and the browser
will apply its own defaults. This will cause, for example, the
application to no longer be displayed in fullscreen, and instead be
displayed as a regular web page in a browser tab. It's left up to
implementers to decide how to deal with web pages being navigated
in and out of scope. See [[[#applying]]] for the technical details.
</p>
<p>
Finally, as it's possible that a user can install a web application
from any document within an origin, it's good practice to always
declare a [=manifest/scope=] member in a manifest. If the
[=manifest/scope=] member is missing from the manifest, then the
path of the [=manifest/start_url=] member is used as a fallback.
And if the [=manifest/start_url=] member is also missing, then the
document URL from which the web application is installed gets used
as the scope. To be sure you don't get any unexpected navigation
behavior, always include a [=manifest/scope=] member preferably set
to `"/"`.
</p>
</section>
</section>
<section>
<h3>
`dir` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">dir</dfn></code> member specifies the <dfn>base
direction</dfn> for the <a>localizable members</a> of the
<a>manifest</a>. The [=manifest/dir=] member's value can be set to a
<a>text-direction</a>.
</p>
<p>
The <dfn>localizable members</dfn> are:
</p>
<ul>
<li>[=manifest/name=] member.
</li>
<li>[=manifest/short_name=] member.
</li>
<li>[=Shortcut item's=] [=shortcut item/name=] member.
</li>
<li>[=Shortcut item's=] [=shortcut item/short_name=] member.
</li>
<li>[=Shortcut item's=] [=shortcut item/description=] member.
</li>
</ul>
<p>
The <dfn>text-directions</dfn> are the following, implying that the
value of the <a>localizable members</a> is by default:
</p>
<dl>
<dt>
"<dfn data-dfn-for="text-direction">ltr</dfn>"
</dt>
<dd>
Left-to-right text.
</dd>
<dt>
"<dfn data-dfn-for="text-direction">rtl</dfn>"
</dt>
<dd>
Right-to-left text.
</dd>
<dt>
"<dfn data-dfn-for="text-direction">auto</dfn>" (default)
</dt>
<dd>
No explicit directionality.
</dd>
</dl>
<p>
The <dfn>text-direction list</dfn> is the [=list=] «
"[=text-direction/ltr=]", "[=text-direction/rtl=]",
"[=text-direction/auto=]" ».
</p>
<p>
When displaying the <a>localizable members</a> to an end-user, the
use agent SHOULD:
</p>
<ol class="algorithm">
<li>If the <a>base direction</a> is [=text-direction/ltr=] or
[=text-direction/rtl=], override <a data-cite="bidi#P3">Rule P3</a>
of [[BIDI]], setting the paragraph embedding level to 0 if the
<a>base direction</a> is [=text-direction/ltr=], or 1 if the <a>base
direction</a> is [=text-direction/rtl=].
</li>
<li>Otherwise the <a>base direction</a> is "[=text-direction/auto=]",
in which case determine the text's direction by applying
<a data-cite="bidi#P1">Rule P1</a> of [[BIDI]].
</li>
</ol>
<p>
To <dfn>process the `dir` member</dfn>, given [=ordered map=]
|json:ordered map| and [=ordered map=] |manifest:ordered map|:
</p>
<ol class="algorithm">
<li>Set |manifest|["dir"] to "auto".
</li>
<li>If |json|["dir"] doesn't [=map/exist=] or if |json|["dir"] is not
a [=string=], return.
</li>
<li>If [=text-direction list=] doesn't [=list/contain=]
|json|["dir"], return.
</li>
<li>Set |manifest|["dir"] to |json|["dir"].
</li>
</ol>
</section>
<section>
<h3>
`lang` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">lang</dfn></code> member is a <a>string</a> in the form of
a <a>language tag</a> that specifies the primary language for the
values of the manifest's <a>localizable members</a> (as knowing the
language can also help with directionality).
</p>
<p>
A <dfn>language tag</dfn> is a <a>string</a> that matches the
production of a `Language-Tag` defined in the [[BCP47]]
specifications (see the <a href=
"https://www.iana.org/assignments/language-subtag-registry">IANA
Language Subtag Registry</a> for an authoritative list of possible
values). That is, a language range is composed of one or more
<dfn>subtags</dfn> that are delimited by a U+002D HYPHEN-MINUS ("-").
For example, the '`en-AU`' language range represents English as
spoken in Australia, and '`fr-CA`' represents French as spoken in
Canada. Language tags that meet the validity criteria of [[RFC5646]]
section 2.2.9 that can be verified without reference to the IANA
Language Subtag Registry are considered structurally valid.
</p>
<p>
To <dfn>process the `lang` member</dfn>, given [=ordered map=]
|json:ordered map| and [=ordered map=] |manifest:ordered map|:
</p>
<ol class="algorithm">
<li>If |json|["lang"] doesn't [=map/exist=] or if |json|["lang"] is
not a [=string=], return.
</li>
<li>If calling <a data-cite=
"ECMA-402#sec-isstructurallyvalidlanguagetag">IsStructurallyValidLanguageTag</a>
with |json|["lang"] returns `false`, return.
</li>
<li>Set |manifest|["lang"] to the result of calling the
<a data-cite="ECMA-402#sec-canonicalizeunicodelocaleid">CanonicalizeUnicodeLocaleId</a>
abstract operation with |json|["lang"].
</li>
</ol>
</section>
<section>
<h3>
`name` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">name</dfn></code> member is a <a>string</a> that
represents the name of the web application as it is usually displayed
to the user (e.g., amongst a list of other applications, or as a
label for an icon).
</p>
<p>
The [=manifest/name=] member serves as the <a data-cite=
"accname-1.2#dfn-accessible-name">accessible name</a> of an
[=installed web application=].
</p>
<p class="note" title="Processing the `name` member">
When [=processing a manifest=], the [=process a text member=]
algorithm is used to process the [=manifest/name=] member.
</p>
</section>
<section>
<h3>
`short_name` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">short_name</dfn></code> member is a <a>string</a> that
represents a short version of the name of the web application. It is
intended to be used where there is insufficient space to display the
full name of the web application.
</p>
<p class="note" title="Processing the `short_name` member">
When [=processing a manifest=], the [=process a text member=]
algorithm is used to process the [=manifest/short_name=] member.
</p>
</section>
<section>
<h3>
`scope` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">scope</dfn></code> member is a <a>string</a> that
represents the [=manifest/navigation scope=] of this web
application's <a>application context</a>.
</p>
<aside class="note" title="Default scope">
<p>
The "default scope" (when [=manifest/scope=] member is missing,
empty, or failure) is the [=start URL=], but with its filename,
query, and fragment removed.
</p>
</aside>
<p>
To <dfn>process the `scope` member</dfn>, given [=ordered map=]
|json:ordered map| and [=ordered map=] |manifest:ordered map|:
</p>
<ol class="algorithm">
<li>Set |manifest|["scope"] to the result of [=URL Parser|parsing=]
"." with |manifest|["start_url"] as the base URL.
</li>
<li>If |json|["scope"] is the empty string, then return.
</li>
<li>Let |scope:URL| be the result of [=URL Parser|parsing=]
|json|["scope"] with |manifest URL| as the base URL.
</li>
<li>If |scope| is failure, return.
</li>
<li>From |scope|, remove the [=url/query=] and [=url/fragment=]
components.
</li>
<li>If |manifest|["start_url"] is not [=URL/within scope=] of
|scope|, return.
</li>
<li>Otherwise, set |manifest|["scope"] to |scope|.
</li>
</ol>
</section>
<section>
<h3>
`icons` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">icons</dfn></code> member are images that serve as iconic
representations of the web application in various contexts. For
example, they can be used to represent the web application amongst a
list of other applications, or to integrate the web application with
an <abbr title="Operating system">OS</abbr>'s task switcher and/or
system preferences.
</p>
<p>
If there are multiple equally appropriate images in
[=manifest/icons=], a user agent MUST use the last one declared in
order at the time that the user agent collected the list of
[=manifest/icons=]. If the user agent tries to use an icon but that
icon is determined, upon closer examination, to be inappropriate
(e.g. because its content type is unsupported), then the user agent
MUST try the next-most-appropriate icon as determined by examining
the [=manifest image resource=]'s members.
</p>
<aside class="note">
<p>
When [=processing a manifest=], the [=process image resources=]
algorithm is used to process the [=manifest/icons=] member.
</p>
</aside>
</section>
<section>
<h3>
`display` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">display</dfn></code> member represents the developer's
preferred <a>display mode</a> for the web application. Its value is a
[=display mode=].
</p>
<p>
To <dfn>process the `display` member</dfn>, given [=ordered map=]
|json:ordered map| and [=ordered map=] |manifest:ordered map|:
</p>
<ol class="algorithm">
<li>Set |manifest|["display"] to "browser".
</li>
<li>If |json|["display"] doesn't [=map/exist=] or |json|["display"]
is not a a [=string=], return.
</li>
<li>If [=display modes list=] doesn't [=list/contain=]
|json|["display"], return.
</li>
<li>Set |manifest|["display"] to |json|["display"].
</li>
</ol>
</section>
<section>
<h3>
`orientation` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">orientation</dfn></code> member is a <a>string</a> that
serves as the <a>default screen orientation</a> for all <a>top-level
browsing contexts</a> of the web application. The possible values are
those of the {{OrientationLockType}} enum, which in this
specification are referred to as the <dfn>orientation values</dfn>
(i.e., "any", "natural", "landscape", "portrait", "portrait-primary",
"portrait-secondary", "landscape-primary", or "landscape-secondary").
</p>
<p>
If the user agent supports the value of the [=manifest/orientation=]
member as the <a>default screen orientation</a>, then that serves as
the <a>default screen orientation</a> for the life of the web
application (unless overridden by some other means at runtime). This
means that the user agent MUST return the orientation to the
<a>default screen orientation</a> any time the orientation is
unlocked [[SCREEN-ORIENTATION]] or the <a>top-level browsing
context</a> is <a>navigated</a>.
</p>
<p class="note">
Although the specification relies on the [[SCREEN-ORIENTATION]]'s
{{OrientationLockType}}, it is OPTIONAL for a user agent to implement
the [[SCREEN-ORIENTATION]] API. Supporting the [[SCREEN-ORIENTATION]]
API is, of course, encouraged.
</p>
<p>
Certain UI/UX concerns and/or platform conventions will mean that
some screen orientations and <dfn>cannot be used together</dfn>.
Which orientations and display modes cannot be used together is left
to the discretion of implementers. For example, for some user agents,
it might not make sense to change the <a>default screen
orientation</a> of an application while in `browser` <a>display
mode</a>.
</p>
<p class="note">
Once the web application is running, other means can change the
orientation of a <a>top-level browsing context</a> (such as via
[[SCREEN-ORIENTATION]] API).
</p>
<p>
To <dfn>process the `orientation` member</dfn>, given [=ordered map=]
|json:ordered map| and [=ordered map=] |manifest:ordered map|:
</p>
<ol class="algorithm">
<li>If |json|["orientation"] doesn't [=map/exist=] or
|json|["orientation"] is not a [=string=], return.
</li>
<li>If |json|["orientation"] doesn't [=list/contain=] any of the
[=orientation values=], return.
</li>
<li>Set |manifest|["orientation"] to |json|["orientation"].
</li>
</ol>
</section>
<section>
<h3>
`start_url` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">start_url</dfn></code> member is a <a>string</a> that
represents the <dfn class="export">start URL</dfn> , which is
<a>URL</a> that the developer would prefer the user agent load when
the user launches the web application (e.g., when the user clicks on
the icon of the web application from a device's application menu or
homescreen).
</p>
<p>
The [=manifest/start_url=] member is purely advisory, and a user
agent MAY <a>ignore</a> it or provide the end-user the choice not to
make use of it. A user agent MAY also allow the end-user to modify
the URL when, for instance, a bookmark for the web application is
being created or any time thereafter.
</p>
<p>
To <dfn>process the `start_url` member</dfn>, given [=ordered map=]
|json:ordered map|, [=ordered map=] |manifest:ordered map|, [=URL=]
|manifest URL:URL|, and [=URL=] |document URL:URL|:
</p>
<ol class="algorithm">
<li>Set |manifest|["start_url"] to |document URL|.
</li>
<li>If |json|["start_url"] doesn't [=map/exist=] or
|json|["start_url"] is not a [=string=], return.
</li>
<li>If the type of |json|["start_url"] is not [=string=], or if
|json|["start_url"] is the empty string, return.
</li>
<li>Let |start URL:URL| be the result of [=URL Parser|parsing=]
|json|["start_url"], using |manifest URL| as the base URL.
</li>
<li>If |start URL| is failure, return.
</li>
<li>If |start URL| is not <a>same origin</a> as |document URL|,
return.
</li>
<li>Otherwise, set |manifest|["start_url"] to |start URL|.
</li>
</ol>
<aside class="example">
<p>
For example, if the value of [=manifest/start_url=] is
<samp>../start_point.html</samp>, and the manifest's URL is
<samp>https://example.com/resources/manifest.webmanifest</samp>,
then the result of [=URL parser|parsing=] would be
<samp>https://example.com/start_point.html</samp>.
</p>
</aside>
<section>
<h3>
Privacy consideration: [=manifest/start_url=] tracking
</h3>
<p>
It's conceivable that the [=manifest/start_url=] could be crafted
to indicate that the application was launched from outside the
browser (e.g., `"start_url": "index.html?launcher=homescreen"`).
This can be useful for analytics and possibly other customizations.
However, it is also conceivable that developers could encode
strings into the start_url that uniquely identify the user (e.g., a
server-assigned identifier, such as `"?user=123"`,
`"/user/123/"`, or `"https://user123.foo.bar"`). This is
fingerprinting/privacy sensitive information that the user might
not be aware of.
</p>
<p class="note" title="Don't add identifiers to start URLs">
It is bad practice for a developer to use the [=start URL=]
to include information that uniquely identifies a user, as it would
represent a fingerprint that is not cleared when the user clears
site data. However, nothing in this specification can practically
prevent developers from doing this.
</p>
<p>
Given the above, it is RECOMMENDED that, upon installation, or any
time thereafter, a user agent allows the user to inspect and, if
necessary, modify the [=start URL=] of an application.
</p>
<p>
A user agent MAY offer other protections against this form of
fingerprinting. For example, if a user clears data from an origin,
the user agent MAY offer to uninstall applications that are
[=manifest/within scope=] of that origin, thus removing the
potential fingerprint from the application's start URL.
</p>
</section>
</section>
<section>
<h3>
`id` member
</h3>
<p>
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">id</dfn></code> member is a <a>string</a> that represents
the <dfn>identity</dfn> for the application. The [=identity=] takes
the form of a URL, which is same origin as the [=start URL=].
</p>
<p>
The [=identity=] is used by user agents to uniquely identify the
application universally. When the user agent sees a manifest with an
[=identity=] that does not correspond to an already-installed
application, it SHOULD treat that manifest as a description of a
distinct application, even if it is served from the same URL as that
of another application. When the user agent sees a manifest where
|manifest|["id"] is [=url/equal=] with [=URL serializer/exclude
fragment|exclude fragment true=] to the [=identity=] of an
already-installed application, it SHOULD be used as a signal that
this manifest is a replacement for the already-installed
application's manifest, and not a distinct application, even if it is
served from a different URL than the one seen previously.
</p>
<p class="note">
The [=identity=] can be used by a service that collects lists of web
applications to uniquely identify applications.
</p>
<p class="note">
The [=identity=] is processed like a URL but it doesn't point to a
resource that can be navigated to, so it's not required to be
[=URL/within scope=].
</p>
<p>
To <dfn>process the `id` member</dfn>, given [=ordered map=]
|json:JSON|, [=ordered map=] |manifest:ordered map|:
</p>
<ol class="algorithm">
<li>Set |manifest|["id"] to |manifest|["start_url"].
</li>
<li>If the type of |json|["id"] is not [=string=], return.
</li>
<li>If |json|["id"] is the empty string, return.
</li>
<li>Let |base origin| be |manifest|["start_url"]'s [=url/origin=].
</li>
<li>Let |id:URL| be the result of [=URL Parser|parsing=] |json|["id"]
with |base origin| as the base URL.
</li>
<li>If |id| is failure, return.
</li>
<li>If |id| is not [=same origin=] as |manifest|["start_url"],
return.
</li>
<li>Set |manifest|["id"] to |id|.
</li>
</ol>
<aside class="example" title="Resulting ids">
<p>
The table below shows some example `id`s resulting from the
[=process the `id` member=] steps.
</p>
<table class="data">
<tr>
<th>
|json|["id"]
</th>
<th>
|manifest|["start_url"]
</th>
<th>
|manifest|["id"]
</th>
</tr>
<tr>
<td>
<i>undefined</i>
</td>
<td>
"https://example.com/my-app/start"
</td>
<td>
"https://example.com/my-app/start"
</td>
</tr>
<tr>
<td>
<i>undefined</i>
</td>
<td>
"https://example.com/my-app/#here"
</td>
<td>
"https://example.com/my-app/#here"
</td>
</tr>
<tr>
<td>
""
</td>
<td>
"https://example.com/my-app/start"
</td>
<td>
"https://example.com/my-app/start"
</td>
</tr>
<tr>
<td>
"/"
</td>
<td>
"https://example.com/my-app/start"
</td>
<td>
"https://example.com/"
</td>
</tr>
<tr>
<td>
"foo"
</td>
<td>
"https://example.com/my-app/start"
</td>
<td>
"https://example.com/foo"
</td>
</tr>
<tr>
<td>
"./foo"
</td>
<td>
"https://example.com/my-app/start"
</td>
<td>
"https://example.com/foo"
</td>
</tr>
<tr>
<td>
"https://example.com/foo"
</td>
<td>
"https://example.com/my-app/start"
</td>
<td>
"https://example.com/foo"
</td>
</tr>
<tr>
<td>
"https://anothersite.com/foo"
</td>