|
|
|
|
|
by bartread
1974 days ago
|
|
You don't need to worry about whether the image is in the cache or not. If you have to hit the server on that static URL, you write a request handler that will always give you back a new image with a new ID encoded in the pixels. Think of it like dynamic page generation on the server side, but for an image instead. Every time you hit the same URL you get a different image. On the client you can decode that ID and use it throughout your code, in network requests, etc., to track user activity. If the image is already cached you just decode the ID and use it as described above. All the browser cares about is associating a URL with a resource: it doesn't know or care that the resource in question changes every time it's asked for. Also, the client code literally doesn't need to care whether the ID is from an image in cache or an image returned from the server. The server can simply tie all activity for a given ID together on the back end. This is one way of doing it: there are probably others. I'm certainly no expert. |
|