Skip to content

Commit 8102fc5

Browse files
authored
Add id member to manifest (#988)
1 parent e127fd7 commit 8102fc5

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

index.html

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ <h2>
171171
</li>
172172
<li>[=manifest/icons=]
173173
</li>
174+
<li>[=manifest/identity=]
175+
</li>
174176
<li>[=manifest/lang=]
175177
</li>
176178
<li>[=manifest/name=]
@@ -232,6 +234,7 @@ <h3>
232234
"sizes": "128x128"
233235
}],
234236
"scope": "/",
237+
"id": "superracer",
235238
"start_url": "/start.html",
236239
"display": "fullscreen",
237240
"orientation": "landscape",
@@ -811,6 +814,120 @@ <h3>
811814
</p>
812815
</section>
813816
</section>
817+
<section>
818+
<h3>
819+
`id` member
820+
</h3>
821+
<p>
822+
The [=manifest's=] <code><dfn data-export="" data-dfn-for=
823+
"manifest" id="identity">id</dfn></code> member is a <a>string</a> that
824+
represents the <dfn>identity</dfn> for the application.
825+
The [=identity=] takes the form of a URL, which is same origin as the
826+
start URL.
827+
</p>
828+
<p>The [=identity=] is used by user agents to uniquely identify the
829+
application universally. When the user agent sees a manifest with an
830+
[=identity=] that does not correspond to an already-installed
831+
application, it SHOULD treat that manifest as a description of a
832+
distinct application, even if it is served from the same URL as that of
833+
another application. When the user agent sees a manifest where
834+
|manifest|["id"] [=url/equal|equals=] the [=identity=] of an
835+
already-installed application, it SHOULD be used as a signal that this
836+
manifest is a replacement for the already-installed application's
837+
manifest, and not a distinct application, even if it is served from a
838+
different URL than the one seen previously.
839+
</p>
840+
<p class="note">
841+
The [=identity=] can be used by a service that collects lists of web
842+
applications to uniquely identify applications.
843+
</p>
844+
<p class="note">
845+
The [=identity=] is processed like a URL but it doesn't point to a
846+
resource that can be navigated to, so it's not required to be
847+
[=URL/within scope=].
848+
</p>
849+
<p>
850+
To <dfn>process the `id` member</dfn>, given [=object=]
851+
|json:JSON|, [=ordered map=] |manifest:ordered map|:
852+
</p>
853+
<ol class="algorithm">
854+
<li>Set |manifest|["id"] to |manifest|["start_url"].
855+
</li>
856+
<li>If the type of |json|["id"] is not [=string=], return.
857+
</li>
858+
<li>If |json|["id"] is the empty string, return.
859+
</li>
860+
<li>Let |base origin| be |manifest|["start_url"]'s [=url/origin=].</li>
861+
<li>Let |id:URL| be the result of [=URL Parser|parsing=] |json|["id"] with |base origin| as the base URL.
862+
</li>
863+
<li>If |id| is failure, return.
864+
</li>
865+
<li>If |id| is not [=same origin=] as |manifest|["start_url"], return.
866+
</li>
867+
<li>Set |manifest|["id"] to |id|.</li>
868+
</ol>
869+
<aside class="example">
870+
<p>Below table shows some example cases of the |identity| processing algorithm.</p>
871+
<table class="data">
872+
<tr>
873+
<th>|json|["id"]</th>
874+
<th>|manifest|["start_url"]</th>
875+
<th>|manifest|["id"]</th>
876+
</tr>
877+
<tr>
878+
<td><i>undefined</i></td>
879+
<td>"https://example.com/my-app/start"</td>
880+
<td>"https://example.com/my-app/start"</td>
881+
</tr>
882+
<tr>
883+
<td><i>undefined</i></td>
884+
<td>"https://example.com/my-app/#here"</td>
885+
<td>"https://example.com/my-app/#here"</td>
886+
</tr>
887+
<tr>
888+
<td>""</td>
889+
<td>"https://example.com/my-app/start"</td>
890+
<td>"https://example.com/my-app/start"</td>
891+
</tr>
892+
<tr>
893+
<td>"/"</td>
894+
<td>"https://example.com/my-app/start"</td>
895+
<td>"https://example.com/"</td>
896+
</tr>
897+
<tr>
898+
<td>"foo"</td>
899+
<td>"https://example.com/my-app/start"</td>
900+
<td>"https://example.com/foo"</td>
901+
</tr>
902+
<tr>
903+
<td>"./foo"</td>
904+
<td>"https://example.com/my-app/start"</td>
905+
<td>"https://example.com/foo"</td>
906+
</tr>
907+
<tr>
908+
<td>"https://example.com/foo"</td>
909+
<td>"https://example.com/my-app/start"</td>
910+
<td>"https://example.com/foo"</td>
911+
</tr>
912+
<tr>
913+
<td>"https://anothersite.com/foo"</td>
914+
<td>"https://example.com/my-app/start"</td>
915+
<td>"https://example.com/my-app/start"</td>
916+
</tr>
917+
<tr>
918+
<td>"😀"</td>
919+
<td>"https://example.com/my-app/start"</td>
920+
<td>"https://example.com/%F0%9F%98%80"</td>
921+
</tr>
922+
</table>
923+
<p>Since [=manifest/id=] is resolved against [=manifest/start_url=]'s [=URL/origin=], providing
924+
"../foo", "foo", "/foo", "./foo" all resolves to the same [=identifier=]. It is
925+
As such, best practice is to use a leading "/" to be explicit that
926+
the id is a root-relative url path. Also, standard
927+
encoding/decoding rules are apply to the id processing algorithm, as per the [[[URL]]].
928+
</p>
929+
</aside>
930+
</section>
814931
<section>
815932
<h3>
816933
`theme_color` member
@@ -1093,6 +1210,9 @@ <h3>
10931210
<li>[=Process the `start_url` member=] passing |json|, |manifest|,
10941211
|manifest URL|, and |document URL|.
10951212
</li>
1213+
<li>[=Process the `id` member=] passing |json|, |manifest| and
1214+
|document URL|.
1215+
</li>
10961216
<li>[=Process the `scope` member=] passing |json|, |manifest|, and
10971217
|manifest URL|.
10981218
</li>

0 commit comments

Comments
 (0)