Questions? Call (860)407-2687
find us on:

How to Auto Reload ♻ Image 🖼 on a Web Page

short url:
  • How to Auto Reload ♻ Image 🖼 on a Web Page
  • How to Auto Refresh ♻ Image 🖼 on Web Page HTML [for Web Designers]
  • How to Auto Refresh ♻ Multiple Images 🖼 on Web Page HTML [for Web Designers]
  • Free Template Tool to Create Image 🖼 Auto Refresh ♻ in HTML
  • How to Auto Refresh ♻ Image 🖼 on Web Page Javascript [for Web Designers]
  • How to Auto Refresh ♻ Image 🖼 on Web Page PHP [for Web Designers]
  • How to Auto Refresh ♻ Image 🖼 on Web Page [for Regular People]

How to Auto Reload ♻ Image 🖼 on a Web Page

The basic process of auto refreshing an image on a web page simply involves adding a search query to the end of an images src. An images src is the web address of the image on the web server. By adding a different search query at the end of the images location on the web server, it forces the web server to serve up a fresh version of the image instead of pulling the image from cache. This is because the web server is tricked into believing it is a different image being requested.

The easiest and most logical way to ensure a unique search query, every time we wish to auto refresh the image is to use the current time, including seconds, for the search query.

Auto Refresh Webpage Image Using Javascript Time Query.
Image of Auto Refresh Webpage Image Using Javascript Time Query.
Auto Refresh Webpage Image Using Javascript Time Query.

How to Auto Refresh ♻ Image 🖼 on Web Page HTML [for web designers]

Here is the basic code for auto refreshing an image on a web page in HTML. Although the actual code is Javascript code, the code is inserted right into the images HTML code.

Here is a list of this you want to change in the image you wish to auto refresh's HTML code below:

  1. The id of the image. The example below is idOfImageToReload but obviously you want to change that to whatever the id is for your image. Also be sure to change the id in the javascript function built into the images HTML code - document.getElementById('idOfImageToReload').
  2. The alt tag. The example below reads Image of whatever your image is. Change it to whatever you want your auto refresh image's alt tag to be.
  3. The height and the width of the image.
  4. How often you want the image to auto refresh. The number in the code below is 5000 which means 5 seconds. How ever number of seconds you want the image to auto refresh change that number and multiply by 1000. If you want the image to auto refresh every 30 seconds you would change that number to 30000 (note: no commas in the number).

An easier approach is to use the free tool below to automatically create the image auto refresh HTML code for you.

How to Auto Refresh ♻ Multiple Images 🖼 on Web Page HTML [for web designers]

To create the inline code that allows you to refresh more than one image on a web page (there is no limit to the number of images you can auto refresh on a web page) merely requires that you assign unique ID's to each image. Proper html coding specifications require that each ID for an element on a web page be unique anyway. Make sure to update the inline image javascript code to reference the proper image ID.

Click here for example web page to auto refresh multiple image on web page.

Free Template Tool to Create Image 🖼 Auto Refresh ♻ in HTML

Fill out the form below and click the Create Image Auto Refresh HTML button to have the HTML code created for you.

Image SRC
Image HeightImage Width
Image IDSeconds Pause

How to Auto Refresh ♻ Image 🖼 on Web Page Javascript [for web designers]

In case you don't want to use the inline, HTML/Javascript solution above, auto refreshing an image (with the Javascript separate from the HTML) simply involves setting a timer, at a reqular interval (that interval being set as the desired number of seconds we want between refreshes, in seconds * 1000, ie 7000 = 7 seconds, 30000 = 30 seconds, etc.). In Javascript, this is accomplished via the setInterval function.

Here is the basic Javascript code to auto refresh an image at set intervals:

html
1:
2:
3:
4:
5:
6:
7:
var varImgToAutoRefresh=document.getElementById("idOfImageToReload");
var varImgSrc=varImgToAutoRefresh.src;
setInterval(funcRefreshImage,5000);
 
function funcRefreshImage(){
   varImgToAutoRefresh.src=varImgSrc+"?time="+new Date().getTime();
}

How to Auto Refresh ♻ Image 🖼 on Web Page PHP [for web designers]

Because PHP is a server sided and not client side programming language, you can't directly auto refresh an image on a web page using PHP. It can be accomplished indirectly using Javascript. See above on how to auto refresh an image on a web page using Javascript.

How to Auto Refresh Image 🖼 on Web Page [for regular people]

If there is an image you want to auto refresh on a web page of a web site, the best, easiest and most automated way to do this is through the use of a free browser extension of bookmarklet called Image Auto Refresh Bookmarklet.

To use Image Auto Refresh Bookmarklet:

  1. Go here to install the Image Auto Refresh Bookmarklet.
  2. Go to the web page that contains the image you wish to auto refresh.
  3. Click on the bookmarklet. A dialog box will ask you to click on the image you wish to auto refresh so the bookmarklet knows which image to auto refresh for you.
  4. Enter the number of seconds pause between auto refreshes. For example if you want the image to auto refresh on the web page once every 30 seconds, enter the number 30. If you want the image to auto refresh every 2 minutes enter 120 (120 seconds = 2 minutes).
  5. The bookmarklet will then proceed to auto refresh your selected image for you at the time interval you specified

CONTENT RELATED TO HOW TO AUTO RELOAD ♻ IMAGE 🖼 ON A WEB PAGE



Delete Multiple All Google Voice Text Message

... ss will certainly help that inner rage along. The Fast Google Voice Text Message Delete bookmarklet above eliminates two of the steps above. With the bookmarklet dragged and dropped to your web browse ...

What Does Google Analytics Tracking Code Look

... r website, when you log in to Google Analytics, click on the REPORTING tab and you will see the following on your screen: The left hand column contains links, broken up into several different section ...

How To Create Javascript Bookmarklet

... er, the code does not work. Why? Simple. As a security measure, Chrome automatically removes the javascript: part of the bookmarklet code, at the beginning when it is pasted into the Chrome address ba ...

COMMENTS ON HOW TO AUTO RELOAD ♻ IMAGE 🖼 ON A WEB PAGE

Feel free to submit your comment below. Anything that does not contribute and is just spam will automatically be deleted. Questions marked by * are required. Comments are checked by a human to make sure they are not spam/automated and are on topic and related to How to Auto Reload ♻ Image 🖼 on a Web Page.

NAME:
EMAIL:
COMMENT:
HTML OK. Allowable HTML tags include: <p></p>, <i></i>, <b></b>, <em></em>, <strong></strong>, <ul><li></li></ul>, <ol><li></li></ol>
Question ❔
Back to Top