Ben
Ben

Reputation: 403

$ is not defined in firefox

My site is working fine when debugging from visual studio in the browsers IE, Chrome and Opera, but in Firefox I am getting "$ not defined" and "jQuery not defined" errors. I have the following reference to jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>

Upvotes: 2

Views: 7309

Answers (3)

GandalfTheWhite
GandalfTheWhite

Reputation: 149

I wanted to share my experience with this problem: with Firefox I experienced the same error of: "$ is not defined" and I found out that it was caused by missing the attribute "type='text/javascript'" when including the script in the header.

<script src="/js/jquery-1.11.1.min.js" type="text/javascript"></script>

Another addition: be careful about your connection type (secure or not) when including jQuery from external sources by using double backslashes (//) when including the file:

<script  src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>

so as to match your connection security otherwise you might face certificate warnings if your connection is secure and the source of jQuery is not, or vice versa.

Upvotes: 2

Joe Kdw
Joe Kdw

Reputation: 2261

No problem whatever browsers we use to access the jQuery. mostly problem is caused by the traffic flows and sometimes internal security (certificate) which is experienced as invalid request.

Based on my observation and some other preferences, using the jQuery inside of our own site directory (by downloading it) would be much faster without certain obstacle. Therefore,I suggest you to save it in your own web host to ensure everything goes well.

See other ref here

undefined-jquery-error-and-google-api-font

Upvotes: 0

Ben
Ben

Reputation: 403

The problem ended up being that firefox did not trust the connection. Once I navigated to the url https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js in firefox and added a security exception for it my site worked fine.

Upvotes: 3

Related Questions