Or for better performance a simple incremented int variable.

On Mon, Dec 20, 2010 at 10:43, fernando trasvina <[email protected]> wrote:

> use ?Math.random() on ur uri
> or timestamp + Math.random()
>
> On Dec 20, 2010, at 3:35 AM, Amit Agarwal 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/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>
>
>  --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]<jsmentors%[email protected]>
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to