Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [APPL:Dashboard] When image files have changed on disk



On Mon, Nov 21, 2005 at 11:44:24PM -0800, Brian Klock scratched on the wall:
> Supposing you have an image.jpg file that has been loaded into your applet 
> and displayed... if that file has changed on disk, how can you force a 
> reload of it inside of the widget so that the new image is displayed?  If 
> the pathname to the file hasn't changed, it doesn't reload the image 
> automatically, even if you empty the image.src property and then re-set it 
> to the same value.
> 
> The same problem most likely happens with URLs from the web also, I haven't 
> tested that though.

  This is a very very common problem with pages that use JavaScript
  to update graphs, webcams, or other imgs that change.

  The standard technique when dealing with http*: URLs is to append a
  timestamp as an HTTP var,  This makes the URL "different" and forces
  a reload.  Something like this:

  http://www.example.com/imgs/graph.jpg?12326439432

  You can generate the epoch timestamp like this:

   var now = new Date( );
   var fullURL = URL + '?' + now.getTime( );

  I have no idea if this works with file: URLs, however.

    -j


-- 
                     Jay A. Kreibich | CommTech, Emrg Net Tech Svcs
                        email@hidden | Campus IT & Edu Svcs
          <http://www.uiuc.edu/~jak> | University of Illinois at U/C
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden

References: 
 >When image files have changed on disk (From: "Brian Klock" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.