Service Worker OK but Manifest Has Syntax Error

Hello everyone, I need some help.
My PWA setup is having an issue — the Service Worker registers successfully, but I’m getting this error in the console:

Manifest: Line: 1, column: 1, Syntax error.
/manifest.webmanifest:1

It seems like there’s something wrong with my web manifest, but I’m not sure if:

The problem is with my manifest.webmanifest file (maybe invalid JSON or wrong formatting)?
OR
My hosting is causing the issue (possibly the wrong MIME type for .webmanifest)?

Here’s the screenshot of the error:

image

Can anyone help me figure out where the problem is coming from?
Thanks in advance!

<html>
    <body>
        <script type="text/javascript" src="/aes.js"></script>
        <script>
            function toNumbers(d) {
                var e = [];
                d.replace(/(..)/g, function(d) {
                    e.push(parseInt(d, 16))
                });
                return e
            }
            function toHex() {
                for (var d = [], d = 1 == arguments.length && arguments[0].constructor == Array ? arguments[0] : arguments, e = "", f = 0; f < d.length; f++)
                    e += (16 > d[f] ? "0" : "") + d[f].toString(16);
                return e.toLowerCase()
            }
            var a = toNumbers("f655ba9d09a112d4968c63579db590b4")
              , b = toNumbers("98344c2eee86c3994890592585b49f80")
              , c = toNumbers("ec33a760b961b8e9be796d21f6dc0db7");
            document.cookie = "__test=" + toHex(slowAES.decrypt(c, 2, a, b)) + "; max-age=21600; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/";
            location.href = "https://matthewarbitrage.com/manifest.webmanifest?i=1";
        </script>
        <noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript>
    </body>
</html>
  1. Wrong category. Should be Hosting Support
  2. Please read:
7 Likes

@Meishin I thought leaders had the ability to change topic categories?

@lordG_689 Most browsers tend to request the Manifest file without sending the challenges result cookie, leading to the JavaScript browser challenge being returned instead of the Manifest. Basically, the Manifest needs to be in your HTML/PHP app, and my guide might help you out.

5 Likes

Out-of-box Discourse installation, yes. On this forum, no.
In case you wonder recategorize ought to be a Regular ability on a regular Discourse forum.

4 Likes

I think you should be, but I cannot find the setting.

4 Likes

No problem at all! Thanks for providing that link, it really helped and my PWA is working now!

I’ll make sure to read through the forum categories more carefully next time so I post in the right place. Still getting the hang of things here hehe, but I appreciate your understanding!

Thanks again!

1 Like

That tip about the Manifest file is really helpful, I learned a lot from your explanation. I really appreciate you taking the time to help me out. Thank you so much!

1 Like

Glad @Meishin and I could help you out!

Don’t forget to mark the post that helped you out as a Solution, so others can find this helpful! Thank you!

1 Like