meteor-headers icon indicating copy to clipboard operation
meteor-headers copied to clipboard

Offline issue: Uncaught SyntaxError: Unexpected token <

Open gadicc opened this issue 9 years ago • 6 comments

Originally reported by @almogdesign in https://github.com/gadicc/meteor-messageformat/issues/91:

If my app is in offline mode, not internet connection and it loads everything from app cache and groundDB I'm getting the following error message

Resource interpreted as Script but transferred with MIME type text/html: "https://xstaging.goplatfarm.com/headersHelper.js?token=1425899998591.4875". headersHelper.js?token=1425899998591.4875:1 Uncaught SyntaxError: Unexpected token < 4c603d60d86a8256c2320771323525a21c7300dd.js:32

I'm not 100% sure whats casing it

gadicc avatar Mar 09 '15 12:03 gadicc

Yeah, this does seem weird.

I can confirm that headersHelper.js is being transferred with the correct mime-type, both in the code and as being received in Chrome. And also that the syntax is all correct.

So it's quite weird that this is only in offline mode. It seems maybe like a browser cache issue. Do you get the same with any other browser? Are you at all able to see the contents of headersHelper.js from the cache? And/or 4c603d60d86a8256c2320771323525a21c7300dd.js line 32? Not sure what that is :(

gadicc avatar Mar 09 '15 12:03 gadicc

@gadicc right now only tested it on Chrome, which is the only browser we're supporting at the moment

isAlmogK avatar Mar 12 '15 15:03 isAlmogK

Ok, I should also quote from your more recent message:

When offline mode I'm getting the following error message not sure if this is affecting anything.

Resource interpreted as Script but transferred with MIME type text/html: "https://xstaging.goplatfarm.com/headersHelper.js?token=1425982012935.465".

Where we get the first warning but not the 2nd error. In general it's a harmless error but I do prefer to avoid these things if I can, just need to work out where it's coming from. Self note, think about how this can/should be added to the offline manifest.

gadicc avatar Mar 13 '15 08:03 gadicc

I also getting this error on iOS Simulator with cordova build Uncaught Error: SyntaxError: Unexpected token '<':1:http://meteor.local/headersHelper.js?token=1444160435205.5044

tdesc avatar Oct 06 '15 19:10 tdesc

I get this with meteor run android-device as well.

jamesgibson14 avatar Dec 04 '15 18:12 jamesgibson14

@gadicc I've been hitting a similar issue with messageformat (with the /msgfmt/locale/all file), I think it's because meteor seems to lack 404 status code errors by default. In Cordova, the file is not found at meteor.local/ (somehow, not sure why yet).

Meteor returns the error page (with a status code of 200, and text/html instead of application/javascript). It then try to embed it under a script tag which causes the syntax error.

MartinFournier avatar Dec 28 '15 23:12 MartinFournier