Reputation: 331
I am new to web development and have observed something I can't figure out myself.
I can see many websites are using random parameters after the URIs of static files, for example, image-name.jpg?asdhajksdha
, style.css?ahj123hk
, and things like that.
What are the random parameters for?
Upvotes: 0
Views: 98
Reputation: 234847
There can be a couple of uses.
One is to prevent caching. The random numbers fool caching servers (and the browser) into thinking that each request is for a new resource.
Another is that the numbers are actually an identifier that is used to track your behavior. The resource might not even be a static file (the server can rewrite the url before serving up the content). The "random" numbers are tied to keys in a tracking data base. Many email clients will prompt you about loading images that are links in order to help you protect your privacy from that kind of tracking.
Upvotes: 3