Just put a GET attribute in the SRC path with a datetime.

On Mon, Dec 20, 2010 at 10:35, Amit Agarwal <lifea...@gmail.com> wrote:

> Hi every one,
>
> I need to poll an image using javascript and need to perform an action once
> the image is found at its position. This is the code I have written for this
> task.
>
> /*----Image handling script starts here----*/
> var beacon = new Image();
>
>
> beacon.onload = function() {
>
>
>     console.log('Image found');
>     console.log(this.width,this.height);
>
>
>     window.clearInterval(timer);
> };
>
>
> beacon.onerror = function(){
>    console.log('Image not found');
>
> }
> var timer = window.setInterval(function(){
>
>
>     console.log('sending the request again');
>     beacon.src = "http://www.google.co.in/logos/2010/lennon10-hp.gif";;
>
> },2000);
> /*----Image handling script ends here----*/
>
> Problem is that, after one GET request, the response gets cached and
> requests don't get sent everytime I set src. If you examine NET tab, it
> sends request only on first src set and caches the response.
>
> I need to send a fresh request for image every time my code sets the src.
> Any workarounds?
>
> -Regards
> *Amit Agarwal <http:///www.amitagrwal.com>*
> +91-779-822-8765
>
>  --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/jsmentors@jsmentors.com/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/jsmentors@googlegroups.com/
>
> To unsubscribe from this group, send email to
> jsmentors+unsubscr...@googlegroups.com<jsmentors%2bunsubscr...@googlegroups.com>
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to