2

I'm using JQuery for an embedded system that is isolated from the outside word. Therefore jquery exists on the local server (the embedded system). The question is: what would be the best file name to include JQuery in my html?

  1. <script type="text/javascript" src="js/jquery.js"></script>
  2. <script type="text/javascript" src="js/jquery-1.6.4.js"></script>

I searched Stackoverflow and found the following threads despite of being useful they don't answer my specific question in this scenario:

Because if later we switch to a newer version, I don't have to go through the html files and update them. This is an embedded system and once it's running we hardly update any file. Besides the customer doesn't need to know the version of the libraries and developers know the version already.

Community
  • 1
  • 1
AlexStack
  • 16,766
  • 21
  • 72
  • 104
  • What does "best" mean here? Why would the file name matter? – bzlm Sep 26 '11 at 08:19
  • Why does it matter? I usually stick with the default name which includes the version. – James Allardice Sep 26 '11 at 08:19
  • Because if later we switch to a newer version, I don't have to go through the html files and update them. This is an embedded system and once it's running we hardly update any file. – AlexStack Sep 26 '11 at 08:23
  • @Alex is there any server-side logic running on the system that you could use to include *one* head snippet into every page? – Pekka Sep 26 '11 at 08:28
  • @Pekka not really. It's an embedded system with a minimal webserver that only fetches the file and sends it to client. No page processing whatsoever. – AlexStack Sep 26 '11 at 09:37

2 Answers2

3

jquery-1.6.4.js is better because

  • it helps clearly identify which version is being used
  • it prevents possible caching issues that might arise if you changed the jQuery version but not the file name.
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
2

Option 2.

Because when you update the version the version number of the file name will act as a cache buster.

This means if a browser caches your file, a change in file name will force it to redownload, as it's a completely new file.

Ben Everard
  • 13,652
  • 14
  • 67
  • 96