google-chromepush-notificationmanifestweb-pushpushpad

Google Chrome: DOMException: Registration failed - manifest empty or missing


I am trying to implement Push Notifications on my website (using Pushpad). Therefore I created a "manifest.json" with following content:

{
    "gcm_sender_id": "my_gcm_sender_id",
    "gcm_user_visible_only": true
}

of course I created a valid GCM-Account and have a sender id

I put the manifest.json into my root directory and I also added this line to my index.php:

<link rel="manifest" href="/manifest.json">

Using Firefox everything works fine and I can send and receive push notifications (so I think the manifest-include works fine), but Chrome won't work...

The console shows following error:

Uncaught (in promise) DOMException: Registration failed - manifest empty or missing

I searched Google for a long time and tried everything I found, but nothing works.

What I tried:

  1. created the manifest.json with "Editor" and saved it as type All Types (so no hidden .txt-file) and also with UTF-8-Encoding.
  2. restarted Chrome
  3. cleared Chrome's cache, history, etc.

I really hope somebody can help me.


Solution

  • Because I didn't find an answer anywhere out there in the WWW, but managed to get it working after some time I want to provide my solution/answer for other users, who probably have the same problem:

    In the file where I inlcuded the Pushpad files I wrote some PHP-Code before the <head>-Tag to include some files, e.g. for database connection. After I moved the PHP-Code below the <head>-Tag everything worked fine.