Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline issue: Uncaught SyntaxError: Unexpected token < #37

Open
gadicc opened this issue Mar 9, 2015 · 6 comments
Open

Offline issue: Uncaught SyntaxError: Unexpected token < #37

gadicc opened this issue Mar 9, 2015 · 6 comments

Comments

@gadicc
Copy link
Owner

gadicc commented Mar 9, 2015

Originally reported by @almogdesign in gadicc/meteor-messageformat#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
Copy link
Owner Author

gadicc commented Mar 9, 2015

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 :(

@isAlmogK
Copy link

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

@gadicc
Copy link
Owner Author

gadicc commented Mar 13, 2015

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.

@tdesc
Copy link

tdesc commented Oct 6, 2015

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

@jamesgibson14
Copy link

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

@MartinFournier
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants