Bypassing browser cached documents.
The below is an example;
<!DOCTYPE html>
<html>
<head>
<title>Refresh Image</title>
</head>
<body>
<!-- Display the image -->
<img id="gfgimage" src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-20.png"
width="500" />
<script>
// Create a timestamp
var timestamp = new Date().getTime();
// Get the image element
var image = document.getElementById("gfgimage");
// Adding the timestamp parameter to image src
image.src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-20.png?t=" + timestamp;
console.log(image.src);
</script>
</body>
</html>
[source]
No comments:
Post a Comment
Note: only a member of this blog may post a comment.