0
本地主機上的推送通知無法訪問manifest.json。推送通知爲Web應用程序提供清單空或缺少錯誤
其次從https://developers.google.com/web/fundamentals/getting-started/push-notifications/
我manifest.json的內容(隱藏項目數)
"name": "xyz",
"short_name": "x",
"icons": [{
"src": "images/icon_add.gif",
"sizes": "192x192",
"type": "image/gif"
}],
"start_url": "my_link",
"display": "standalone",
"gcm_sender_id": "my_app_id",
"gcm_user_visible_only": true
注意
- manifest.json的是從根本的步驟。
- 到manifest.jason的鏈接位於
<head>
的開頭。 index.jsp中的 <head>
是在啓動/第一要素
的index.jsp
<head>
<link rel="manifest" href="/manifest.json"/>
<script src="javascript/main.js"></script>
.....
的web.xml
<web-app id="XYZ">
<display-name>XYZ</display-name>
.....
<welcome-file-list>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
開業localhost:8080/XYZ/index.htm
和彈出通知不會一起工作從控制檯下面的錯誤。
如下嘗試:
- 改變
link
標籤type attribute
。 - 已移動
link
和script
標籤位於index.jsp標籤頂部head
。
任何形式的幫助,高度讚賞。