If you want to get anal, you could set a setTimeout and listen for the load
event on the image. That way if it takes a bit longer to load an image one
time the code will hold off on firing another request. (Probably not an
issue though if you are waiting 60 seconds.)


On Thu, Oct 17, 2013 at 6:46 AM, Raymond Camden <raymondcam...@gmail.com>wrote:

> Real quick example here. It uses a date object to add a unique URL
> parameter to the end which should help with caching. No jQuery used, just
> standard HTML. The querySelector call is *kinda* modern-ish only (see
> caniuse.com for specifics) and could be replaced by
> document.getElementById. Oh - and I used 3 seconds. You want to change that.
>
> <!doctype html>
> <html>
> <head>
>     <title>My Page</title>
>     <meta name="viewport" content="width=device-width, initial-scale=1">
> </head>
> <body>
>
>     <img src="sourceimage.jpg" width="300" height="300" id="theImage">
>
> <script>
> document.addEventListener("DOMContentLoaded", function() {
>
>     var img = document.querySelector("#theImage");
>     var src = "./sourceimage.jpg";
>
>     window.setInterval(function() {
>         img.src = src + "?d=" + (new Date().getTime());
>         console.log(img.src);
>     },3000);
>
> }, false);
> </script>
> </body>
> </html>
>
>
> On Thu, Oct 17, 2013 at 6:36 AM, Raymond Camden 
> <raymondcam...@gmail.com>wrote:
>
>> You can use a setInterval call in JS to run every 60 seconds and reload
>> the image. You don't need a jQuery plugin for this.
>>
>>
>> On Thu, Oct 17, 2013 at 6:16 AM, Mike K <afpwebwo...@gmail.com> wrote:
>>
>>>
>>> I have a page with a webcam image in it.   The webcam uploads a new image
>>> every 60 seconds, and I use a HTML refresh to refresh the whole page
>>> every
>>> 60 seconds.
>>>
>>> It seems a bit clunky to me.   It's worked just fine for several years,
>>> but
>>> I'd like to see if i can find a way to refresh only the div that contains
>>> the image.  (or iframe if that's a better way to do it but i'd like ot
>>> stay
>>> away from frames and iframes if i can).
>>>
>>> Does anyone know how I could do this?  i.e. just refresh part of the page
>>> automatically?    Is there a jquery plugin that would do that?  It needs
>>> to
>>> be fully automatic so the page just changes, a bit like the way facebook
>>> changes all by itself as new material is received.
>>>
>>>
>>>
>
> --
> ===========================================================================
> Raymond Camden, Adobe Developer Evangelist
>
> Email : raymondcam...@gmail.com
> Blog : www.raymondcamden.com
> Twitter: cfjedimaster
>



-- 
===========================================================================
Raymond Camden, Adobe Developer Evangelist

Email : raymondcam...@gmail.com
Blog : www.raymondcamden.com
Twitter: cfjedimaster


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356933
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to