I have a standard piece of HTML but cannot get jQuery to work on IE. I tried IE10 and IE11, as well as IE8 and 9 emulated in IE10.
I even tried using the code from HTML5Boilerplate. I am testing for jquery and is not loaded.
Code works in all other browsers. I am running this on my local, not on a server.
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
if (window.jQuery) {
// jQuery is available.
} else {
console.log("-- no jquery --");
}
</script>
</body>
</html>
Why can't I get this to work in IE ?
I get -- no jquery -- SCRIPT5007: The value of the property '$' is null or undefined, not a Function object
in the console.
Also, if I type jQuery().jquery
in the console, I get undefined
.
Network tab is not displaying any errors.
Quote OP:
Then you need to specify a scheme, otherwise the browser may assume that
src="//domain.com/script.js"
issrc="file://domain.com/script.js"
, which will break since you're not hosting this resource locally.References:
Is it valid to replace http:// with // in a <script src="http://...">?
https://stackoverflow.com/a/7818464/594235
https://stackoverflow.com/a/11372220/594235