hi
is there code to auto reload images if it doesn't loaded at first time in users browser ?

It would be useful to know why you need this since the solution will require javascript and you can't rely in javascript is something is going wrong from the beginning... for example if the visitor's connection is pretty low.

Thanks Dear ardav , but is it php or javascript code ?

hi Dear RamiroS , sometimes the all page loaded in users page but image stuck or not loaded in user's browser , that why i need it

Member Avatar for diafol

I think you'll be needing js. The server sends all the info but it is up to the browser to display it.

Thanks Dear ardav , but is it php or javascript code ?

hi Dear RamiroS , sometimes the all page loaded in users page but image stuck or not loaded in user's browser , that why i need it

Yeah, but in that case it may be the code is messed up, not light. Are you using css? unless the visitor has a really bad connection images should load. Always. Images are just part of the code like text.

Also if you are trying to reload images with js it may bring new problems. I would suggest to focus your efforts on knowing why the images do not display since it is not a common issue.

Also if you are trying to reload images with js it may bring new problems

hi RamiroS , what kind of these problem could happen ?

an endless unbreakable loop of trying to download a failed image is one

Dear ardav ,
i have tried the code and i inserted it in .js file and put it in the head , but it doesn't work , is there something missing or something wrong should i fix to make it work ?


Thanks Dear almostbob
but i don't mean to reload over and over , i just needed to be load just IF it doesn't loaded at first time because of many thumbnails images are already downloading and maybe some of them messed up

Member Avatar for diafol

Can't really help - js ain't my thing - I've only got a jobber's understanding. The script I mentioned has a reload limit set to 5, so that should avoid an infinite loop, but as for why it doesn't work - no idea.

Does it work in Firefox? I think the script may be for Greasemonkey - you can download it for FF. However, I don't think it will work for IE etc. There is a Greasemonkey for IE here: http://www.gm4ie.com/

I think this may be taking things to extreme though. As RamiroS/AlmostBob state, images not displaying is strange. Is it due to the fact that they are large images? How about optimising them (reducing the filesize)? If the images are png files, converting them to either gif or jpg may help.

If you've got a slow connection and are trying to view an image-heavy page, the page should load by the end - it just takes time. If you've got a js script to do the image loading - this may be your problem. CSS images and <img> images should load.

Thanks Mr ardav
i would love to see you soon on other topics

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.