I am trying to get my jQuery functions to work on IE8. I am loading the library from Google's servers (http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js).
The $(function(){})
is never called. Instead, I get an error Object expected
. I opened the developer and ran typeof $
in the console, and it came up as undefined
.
I have tried going to other sites that I know use jQuery (jquery.com), and those all work, is there something I might be missing here?
In short, it's because of the IE8 parsing engine.
Guess why Microsoft has trouble working with the new HTML5 tags (like "section") too? It's because MS decided that they will not use regular XML parsing, like the rest of the world. Yes, that's right - they did a ton of propaganda on XML but in the end, they fall back on a "stupid" parsing engine looking for "known tags" and messing stuff up when something new comes around.
Same goes for IE8 and the jquery issue with "load", "get" and "post". Again, Microsoft decided to "walk their own path" with version 8. Hoping that they solve(d) this in IE9, the only current option is to fall back on IE7 parsing with
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
.Oh well... what a surprise that Microsoft made us post stuff on forums again. ;)
I had this problem and tried the solutions mentioned here with no success.
Eventually, I realised that I was linking to the Google CDN version of the script using an
http URL
while the page embedding the script was anhttps page
.This caused IE to not load jquery (it prompts the user whether they want to load only secure content). Changing the Google CDN URL to use the https scheme fixed the problem for me.
I think that you have same problem as I do:
Because of cross domain reference. Try to host jquery.js on same domain.
Maybe you have inPrivate Filtering turned on?
The error
Object expected
is raised because Jquery is not loaded. This happens because of browser security (usually IE) which does not allow you executing external javascript source code. You can correct this problem by:OR
I prefer the first solution.
Maybe you insert two scripts,it should be work.