Reputation: 408
I have seen a code like this and wonder what that curly brackets for, is it some kind of argumant pass?
<script type="text/javascript" src="some_script.js?{0}"></script>
Upvotes: 3
Views: 225
Reputation: 16923
it looks like a method to avoid caching by browser. some people do it like this:
<script type="text/javascript" src="some_script.js?timestamp=1235124321"></script>
Upvotes: 2
Reputation: 163301
In a URL, after the question mark ?
is the query string. This is where you specify parameters for the server.
In this case since those brackets aren't encoded (as %7B0%7D
), I suspect you're actually seeing this in the context of a template engine, and {0}
is a random number. This is commonly used to avoid caching files, since with the random number you effectively have a new URL every time. I don't know what template engine you're using... several use this notation.
Upvotes: 5
Reputation: 943216
There is no special meaning, it is just part of the URL (since it is after a ?
it is part of the query string).
Some code (which could be server or client side) might do something with it, but that is specific to the website.
It might be updated programatically to act as a cache busting feature (changing the number changes the URL, so the script would be loaded as a new URL and not as a cached version with a potentially stale script in it).
Upvotes: 2