Search code examples
httpurlquery-stringimageurl

What does ?t=some-number mean when used at the end of an image url


Here is the example image url I found on Steam.

https://steamcommunity-a.akamaihd.net/public/shared/images/header/globalheader_logo.png?t=962016

The image url gives the same result with or without the ?t=962016. What is it called? And what does it do?


Solution

  • ?t=962016

    This is a technique to disable browser caching, browser sees it as a new url, and fetches the resource again from web server. The resource can be image, css file, js file etc. This is the most common use case, but can be also used differently by the web server.

    There is another use case also. I have done this one of my project.

    I have a made all requests to *.jpg handle by a php script. Eg: mysite.com/user/avatar.jpg?id=100

    avatar.jpg is actually a php script which takes the query param (in this case the id 100) and returns the correspond user's avatar (user with id 100). Browser see this as an image. Another advantage is we can disable hot linking directly to this image, as the script can check if the request is originated from the same domain.