Help me to understand <script src="some.js?param1=one;param2=two" /> Help me to understand <script src="some.js?param1=one;param2=two" /> ajax ajax

Help me to understand <script src="some.js?param1=one;param2=two" />


Running Non-JS Code within .js Extensions

In cases like this, that source .js file might (given proper server-configurations) actually have PHP/.NET code within it, which can read those appended values.

As you said, Avoiding Cache...

Additionally, people will at times append a random string at the end of their referenced elements to avoid loading cached data.


The URL having '.js' means nothing. It could still be handled by a server-side script like an ASP or PHP.


Either the javascript file is not static (it is generated by the server based on the parameters in its querystring)

OR

In the JavaScript file itself, you can have it check its own querystring parameters (not just that of the page, but that of the javascript source url).

OR

(This doesn't exactly match your scenario, but) you can also add parameters at the end of image and script urls as a way of versioning. The version with the url="somescript.js?V=3" will be cached by the user until the page then changes and the url is not="somescript.js?V=4". The file will be replaced by the version on the server no matter what the browser setting may be.

My guess (without looking at this specific case) is that the javascript file is reading its own querystring. I have done this, and its very helpful.