gpt4 book ai didi

json - 渐进式 Web 应用程序是否可以将 Web list 嵌入到 html 页面中?

转载 作者:行者123 更新时间:2023-12-04 03:15:57 25 4
gpt4 key购买 nike

我想通过如下方式嵌入我的 index.html 中的 list 文件,但似乎不受支持。是否可以在网页中嵌入 list 描述?

<link rel="manifest" href="data:application/manifest+json;base64,PCVAIFBhZ2UgQ29udGVudFR5cGU9ImFwcGxpY2F0aW9uL2pzb24iICU+DQp7DQoJIm5hbWUiOiAiU2hhcmVQb2ludCBUaXRsZSIsDQoJInNob3J0X25hbWUiOiAiU1AgVGl0bGUiLA0KCSJkZXNjcmlwdGlvbiI6ICJUaGUgb25lIGFuZCBvbmx5IFNoYXJlUG9pbnQgU2l0ZSBUaXRsZSBwcm9ncmFtISIsDQoJInN0YXJ0X3VybCI6ICJpbmRleC5odG1sIiwNCgkiaWNvbnMiOiBbDQoJCXsNCgkJCSJzcmMiOiAiYW5kcm9pZC1jaHJvbWUtMTQ0eDE0NC5wbmciLA0KCQkJInNpemVzIjogIjE0NHgxNDQiLA0KCQkJInR5cGUiOiAiaW1hZ2VcL3BuZyINCgkJfSwNCgkJew0KCQkJInNyYyI6ICJhbmRyb2lkLWNocm9tZS0xOTJ4MTkyLnBuZyIsDQoJCQkic2l6ZXMiOiAiMTkyeDE5MiIsDQoJCQkidHlwZSI6ICJpbWFnZVwvcG5nIg0KCQl9LA0KCQl7DQoJCQkic3JjIjogImFuZHJvaWQtY2hyb21lLTI1NngyNTYucG5nIiwNCgkJCSJzaXplcyI6ICIyNTZ4MjU2IiwNCgkJCSJ0eXBlIjogImltYWdlXC9wbmciDQoJCX0NCgldLA0KICAgICJiYWNrZ3JvdW5kIjogIiNmZjAwMDAiLA0KCSJ0aGVtZV9jb2xvciI6ICIjZmZmZmZmIiwNCgkiZGlzcGxheSI6ICJzdGFuZGFsb25lIg0KfQ0K">

最佳答案

您问题中的数据 URI 没有任何问题。有用。

但是,它包含无效的 JSON。

JSON 无效,因为它以以下开头:

<%@ Page ContentType="application/json" %>

相反,如果您使用:
<link rel="manifest" href="data:application/manifest+json;base64,ewoKCSJuYW1lIjogIlNoYXJlUG9pbnQgVGl0bGUiLAoKCSJzaG9ydF9uYW1lIjogIlNQIFRpdGxlIiwKCgkiZGVzY3JpcHRpb24iOiAiVGhlIG9uZSBhbmQgb25seSBTaGFyZVBvaW50IFNpdGUgVGl0bGUgcHJvZ3JhbSEiLAoKCSJzdGFydF91cmwiOiAiaW5kZXguaHRtbCIsCgoJImljb25zIjogWwoKCQl7CgoJCQkic3JjIjogImFuZHJvaWQtY2hyb21lLTE0NHgxNDQucG5nIiwKCgkJCSJzaXplcyI6ICIxNDR4MTQ0IiwKCgkJCSJ0eXBlIjogImltYWdlXC9wbmciCgoJCX0sCgoJCXsKCgkJCSJzcmMiOiAiYW5kcm9pZC1jaHJvbWUtMTkyeDE5Mi5wbmciLAoKCQkJInNpemVzIjogIjE5MngxOTIiLAoKCQkJInR5cGUiOiAiaW1hZ2VcL3BuZyIKCgkJfSwKCgkJewoKCQkJInNyYyI6ICJhbmRyb2lkLWNocm9tZS0yNTZ4MjU2LnBuZyIsCgoJCQkic2l6ZXMiOiAiMjU2eDI1NiIsCgoJCQkidHlwZSI6ICJpbWFnZVwvcG5nIgoKCQl9CgoJXSwKCiAgICAiYmFja2dyb3VuZCI6ICIjZmYwMDAwIiwKCgkidGhlbWVfY29sb3IiOiAiI2ZmZmZmZiIsCgoJImRpc3BsYXkiOiAic3RhbmRhbG9uZSIKCn0=">

(这与您拥有的相同,但删除了第一个 JSON-invalid 行)

它会起作用。

明文替代:

或者,您甚至不需要 base-64编码数据:
<link rel="manifest" href='data:application/manifest+json,{"name":"SharePoint Title","short_name":"SP Title","description":"The one and only SharePoint Site Title program!","start_url":"index.html","icons":[{"src":"android-chrome-144x144.png","sizes":"144x144","type":"image/png"},{"src":"android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"android-chrome-256x256.png","sizes":"256x256","type":"image/png"}],"background":"rgb(255,0,0)","theme_color":"rgb(255,255,255)","display":"standalone"}' />

关于json - 渐进式 Web 应用程序是否可以将 Web list 嵌入到 html 页面中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40985761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com