Jquery and internet connectivity

In the PHP file where jquery is loaded I have added this code:

 <script type="text/javascript">
 //<![CDATA[ 
 window.jQuery || document.write('<script type="text/javascript" src="js/jquery-1.10.2.min.js"><\/script>'); 
  //]]> 
</script>

This code tells the browser that if there is no internet connectivity,the jquery files must be “taken” from a local folder.

I am building a web app locally and I want jquery files to be available even when there is no internet connection…

And here is my issue:
I think that such code is meaningless in production environment cause simply in the case of loss of internet connectivity the user will see the usual browser message.

So my question is if you think I should remove this code when going into production.

It attempts to see if jQuery has been loaded (presumably from a CDN) and if not, then falls back to the copy on the server. It doesn’t really have much to do with internet connectivity, so much as whether the CDN was available.

All in all…do you think that it has any point since in case the user will not have connectivity there will not be any connection to the server either way.

Well it can’t harm, but it’s not something I ever bother with.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.