0

I've deployed my app in production and precompiled the assets pipeline, so my application.js contains everything.

while it was all working fine in development (where files were split) it's not working any more in production, and tooltips and everything don't work any more.

the only problem I'm seeing in chrome console is:

Uncaught TypeError: Cannot read property 'msie' of undefined 

it mentions the line containing the error:

jquery.js:9789

although the application.js (precompiled) at line 9789 is blank, and in my source I don't include explicitly any source file called jquery.js, as the jquery is included inside the application.js.

I found that jquery_bbq may be the problem, in I run: grep -r msie * I have only two occurrences:

config/recipes/templates/nginx_configuration.erb
vendor/assets/javascripts/jquery_ba-bbq.min.js

I'm not sure how to troubleshoot this, any ideas ?

thanks in advance

1 Answer 1

3

Something you're including is trying to read the msie property of jQuery.browser. But jQuery doesn't have the jQuery.browser symbol any more (it was deprecated in v1.3 and removed in v1.9).

I can't account for the line number other than to mention that jQuery 1.10.2, un-minified, has exactly that many lines. As for the filename, I assume your HTML or something in your application.js or another script you're loading is loading jquery.js. Chrome's Network tab in the dev tools should tell you what's loading jquery.js.

So the solution is to find out what plug-in or similar you're using that's trying to use jQuery.browser.msie (or $.browser.msie) and deal with the fact it's no longer compatible with jQuery. You've already basically done that and found jquery_ba-bbq.min.js

The other thing is to find and deal with whatever's including jquery.js, if you have jQuery baked into your application.js (presumably an older version, if this was working before you combined things).

Sign up to request clarification or add additional context in comments.

5 Comments

Another option is to use jQuery Migrate Plugin (if possible) - github.com/jquery/jquery-migrate, especially since the error is caused in the 3rd party jquery_ba-bbq JS, not the OP's. I wouldn't call that a fix/solution, but it's temporary to get the code working.
@Ian: Good point. But if the OP thinks that jQuery is already in application.js and yet jquery.js is getting loaded, that needs sorting out. And browser was deprecated and removed for a reason. :-)
Yeah, I didn't fully understand what the OP meant by it all being in application.js (I don't know about asset-pipeline), but you're right that another jquery file being loaded isn't good. And again, I'm not saying the migrate plugin is the permanent fix, but it's hard to upgrade jQuery when plugins use old/deprecated/removed features :(
Thank you, indeed the js using jquery.browser is jquery bbq. (benalman.com/projects/jquery-bbq-plugin) which appears not to be maintained any more, so I'm looking for some other way to edit url parameters to reload the page.
@dongiulio I didn't look too much into the plugin's description, but maybe github.com/browserstate/history.js is something to look at? Sorry if it isn't applicable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.