<html manifest="example.appcache">
你能用javascript添加manifest="example.appcache"部分吗?
不,你不能,因为 html 文件已经发送到服务器,所以对清单属性的进一步更改不会使浏览器对它做出反应。我试过:
document.documentElement.manifest = "site.manifest";
并在有和没有互联网的情况下加载页面,在第二种情况下,它显然说"连接错误"