Reputation: 1793
i wrote code to download jquery file from google CDN first and if not download then i download from local machine.
here is my code
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<script type="text/javascript">
window.jQuery ||
document.write("<script type='text\/javascript' src=<%= this.ResolveClientUrl("~/Scripts/jquery-1.6.2.min.js") %>><\/script>");
</script>
what is wrong in the above code. i check the url http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js and i saw this is valid url. i was sure that jquery file is not download because i watch it by firebug. in my case file is always is downloading from local machine........need advise. thanks
Upvotes: 0
Views: 236
Reputation: 9413
<html>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<script type="text/javascript">
function check()
{
alert("Jquery "+((window.jQuery)?"loaded":"not loaded"));
$("body").css("background",((window.jQuery)?"green":"red"));
}
</script>
<body onLoad="check()">
</body>
</html>
Upvotes: 1
Reputation: 6021
It could be that the file is already downloaded and in cache - try clearing all your cache (http://support.mozilla.com/en-US/kb/How%20to%20clear%20the%20cache) and see if it downloads then.
Upvotes: 1