473,326 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Why using javascript version file

I noticed that some sites use <script
src='fineName.js?ver=XXX'></script(even google)
Someone told me that it's for script changes, means - if the file in
server has been changed than the new XXX will demand to load the new
file.
I find it hard to believe that it's true.
Any suggestions ?

Aug 26 '06 #1
8 1380
Ivo
<ro********@gmail.comschreef
some sites use <script src='fineName.js?ver=XXX'></script>
Someone told me that it's for script changes, means - if the file
in server has been changed than the new XXX will demand to
load the new file.
I find it hard to believe that it's true.
The URL as requested will show up in the server log, that in itself could be
reason enough to use this construct. Additionally, some serverside
functionality could be set up to deliver different files depending on the
URL, regardless of the extension. The filename extension means nothing if
you configure your server to deliver different content depending on the
search string, and send it with the appropriate "application/x-javascript"
content-type header. This is what Google and others are reported to be
doing. What else is there to believe?
Ivo
http://4umi.com/web/html/httpheaders.htm
Aug 26 '06 #2
wrote on 26 aug 2006 in comp.lang.javascript:
I noticed that some sites use <script
src='fineName.js?ver=XXX'></script(even google)
Someone told me that it's for script changes, means - if the file in
server has been changed than the new XXX will demand to load the new
file.
I find it hard to believe that it's true.
Any suggestions ?
The client cannot "know" the server has a changed file on its HD without
receiving info or the actual file from the server.

However the client [read: browser] sees different querystrings as diffeent
files, and will not take a different file from it's cache, but will sent
out for that new file.
http://aaa.ext/a.asp?a=3

and

http://aaa.ext/a.asp?a=11

are considered different.

So, why would it be hard to believe that:

fineName.js?ver=XXX

ant

fineName.js?ver=YYY

are not handled the same way?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 26 '06 #3
Thanks for your reply,

I made some tests for IE && FF (using http debuggers) and found that
the if script file has been changed then the browser will load the new
script. probably due to it's last modified time stamp.
So again, for that reason - there is no need to add ?ver=XXX.
So why using it ?

Evertjan. wrote:
wrote on 26 aug 2006 in comp.lang.javascript:
I noticed that some sites use <script
src='fineName.js?ver=XXX'></script(even google)
Someone told me that it's for script changes, means - if the file in
server has been changed than the new XXX will demand to load the new
file.
I find it hard to believe that it's true.
Any suggestions ?

The client cannot "know" the server has a changed file on its HD without
receiving info or the actual file from the server.

However the client [read: browser] sees different querystrings as diffeent
files, and will not take a different file from it's cache, but will sent
out for that new file.
http://aaa.ext/a.asp?a=3

and

http://aaa.ext/a.asp?a=11

are considered different.

So, why would it be hard to believe that:

fineName.js?ver=XXX

ant

fineName.js?ver=YYY

are not handled the same way?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 27 '06 #4
Thanks for your reply,

I aggree, for this kind of server side mechanism or server logs it's
make sense.
But why use it for script changes if its load the new script in any
case (due to the modified timestamp)?

Ivo wrote:
<ro********@gmail.comschreef
some sites use <script src='fineName.js?ver=XXX'></script>
Someone told me that it's for script changes, means - if the file
in server has been changed than the new XXX will demand to
load the new file.
I find it hard to believe that it's true.

The URL as requested will show up in the server log, that in itself could be
reason enough to use this construct. Additionally, some serverside
functionality could be set up to deliver different files depending on the
URL, regardless of the extension. The filename extension means nothing if
you configure your server to deliver different content depending on the
search string, and send it with the appropriate "application/x-javascript"
content-type header. This is what Google and others are reported to be
doing. What else is there to believe?
Ivo
http://4umi.com/web/html/httpheaders.htm
Aug 27 '06 #5
wrote on 27 aug 2006 in comp.lang.javascript:
Evertjan. wrote:
>wrote on 26 aug 2006 in comp.lang.javascript:
I noticed that some sites use <script
src='fineName.js?ver=XXX'></script(even google)
Someone told me that it's for script changes, means - if the file
in server has been changed than the new XXX will demand to load the
new file.
I find it hard to believe that it's true.
Any suggestions ?

The client cannot "know" the server has a changed file on its HD
without receiving info or the actual file from the server.

However the client [read: browser] sees different querystrings as
diffeent files, and will not take a different file from it's cache,
but will sent out for that new file.
[..]

[Please do not toppost on usenet, and do not quote signatures]
Thanks for your reply,

I made some tests for IE && FF (using http debuggers) and found that
the if script file has been changed then the browser will load the new
script. probably due to it's last modified time stamp.
So if the file has not changed, the browser, having fetched the header
and knowing the lastmodified, will not fetch the rest of the file and
replace the new file?

How did and can you test a unchanged js file is not replaced?
So again, for that reason - there is no need to add ?ver=XXX.
That depends on:
1 if you are right in your testing, I doubt that.
2 if the vers=... was not used to act serverside for other purposes.
So why using it ?
I was not using it, but it seems a good way to force reloading.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 27 '06 #6
Thanks again for your reply,

That exactly my Q, why force reloading if reloading is done any case?

Now about my test, quite simple:
1. Use http debugger like fiddler for ie
2. put script file in your server and reference it from a page.
3. Go to that page address and watch the http header. you'll noticed
that the script file content has been passed to the browser by
'content-length 0'.
4. Refresh the page and you'll see that content-length = 0 for the same
script file.
5. Now go to the server and change the file.
6. Refresh the page in your browser.
7. Watch the debugger note that script file content-length 0.
Done.

Evertjan. wrote:
wrote on 27 aug 2006 in comp.lang.javascript:
Evertjan. wrote:
wrote on 26 aug 2006 in comp.lang.javascript:

I noticed that some sites use <script
src='fineName.js?ver=XXX'></script(even google)
Someone told me that it's for script changes, means - if the file
in server has been changed than the new XXX will demand to load the
new file.
I find it hard to believe that it's true.
Any suggestions ?

The client cannot "know" the server has a changed file on its HD
without receiving info or the actual file from the server.

However the client [read: browser] sees different querystrings as
diffeent files, and will not take a different file from it's cache,
but will sent out for that new file.
[..]

[Please do not toppost on usenet, and do not quote signatures]
Thanks for your reply,

I made some tests for IE && FF (using http debuggers) and found that
the if script file has been changed then the browser will load the new
script. probably due to it's last modified time stamp.

So if the file has not changed, the browser, having fetched the header
and knowing the lastmodified, will not fetch the rest of the file and
replace the new file?

How did and can you test a unchanged js file is not replaced?
So again, for that reason - there is no need to add ?ver=XXX.

That depends on:
1 if you are right in your testing, I doubt that.
2 if the vers=... was not used to act serverside for other purposes.
So why using it ?

I was not using it, but it seems a good way to force reloading.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 27 '06 #7
wrote on 27 aug 2006 in comp.lang.javascript:
That exactly my Q, why force reloading if reloading is done any case?
Sorry, I will not answer anymore,
as you persist in ignoring my request not to toppost.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 27 '06 #8
<ro***********@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Thanks again for your reply,

That exactly my Q, why force reloading if reloading is done any case?
Cache updating based on last-modified date cannot be relied on in all
circumstances.
Users may change their cache settings to never check (or at least not to
check on every request for the same resource).
Or the user is behind a proxy which implements its own caching rules.

Tim
Aug 27 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Mark Constant | last post by:
I have a drop-down list now and I got it so when something is selected from the drop down list it calls a JavaScript function. I want it so the value selected from the drop-down list is sent as a...
2
by: fareeda | last post by:
Is it possible to use JavaScript with XML and XSL? I tried the following but it does not work.. anything missing? test.xml file: -------------- <?xml version="1.0" encoding="ISO8859-1" ?>...
5
by: Robin Johnson | last post by:
Hi, I've written an engine in Javascript for running text adventure games on a web page: http://www.robinjohnson.f9.co.uk/adventure/hamlet.html (That's the only game I've written with it so...
3
by: vanisathish | last post by:
Hi I am running a client side javascript timer to periodically refresh the contents of some tables in the HTML page. The table values are dynmically binded from XML DOM object using the <XML tag...
1
by: Peter Petrillo | last post by:
The Access development group here at this company has exported its reports in xml format from Access 2003. I have no influence on how they have created them. I received the following files xm...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
2
by: Scamjunk | last post by:
I have been desperately looking for a treeview-type solution for my problem for the past three weeks and have been greatly unsuccessful. I am totally new to the world of XSLT and I *don't know*...
3
by: xq386 | last post by:
Question: In the XSL file below I put a part of the code (concerning the euro-sign) in comment. If I remove the comment then it doesn't work anymore. How can this be solved? I run Test.html with...
3
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I...
2
hsriat
by: hsriat | last post by:
For a good programmer, providing good comments in the code is a must. In PHP, giving comments has no demerits. But what about JavaScript? Do you really want those comments to stay in the code and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.