473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

setting the src attribute using script and caching images

I have noticed that when you set the src attribute of an img via script,
(instead of hard-coding in the img tag), although it caches the images,
if you leave the site and return, the browser has to re-cache the images.
Is that just the way it is, or is there a way to not lose the cache?
Thanks.
Jul 27 '05 #1
2 1713
ASM
cosmic foo wrote:
I have noticed that when you set the src attribute of an img via script,
(instead of hard-coding in the img tag), although it caches the images,
if you leave the site and return, the browser has to re-cache the images.


no, I don't think it does re and re and re-cache same image ou same src
onload it always verify if image (even an image.src) is in its cache
just by scripting you realy ensure it does it and get a local source
then you can re-use src instead of url
-> shorter code and image from cache without mistake
(no need to call server (send requests existing img? date? and so one) )

--
Stephane Moriaux et son [moins] vieux Mac
Jul 27 '05 #2

"ASM" <st*********************@wanadoo.fr.invalid> wrote in message
news:42**********************@news.wanadoo.fr...
cosmic foo wrote:
I have noticed that when you set the src attribute of an img via script,
(instead of hard-coding in the img tag), although it caches the images,
if you leave the site and return, the browser has to re-cache the
images.
no, I don't think it does re and re and re-cache same image ou same src
onload it always verify if image (even an image.src) is in its cache
just by scripting you realy ensure it does it and get a local source
then you can re-use src instead of url
-> shorter code and image from cache without mistake
(no need to call server (send requests existing img? date? and so one) )

--
Stephane Moriaux et son [moins] vieux Mac


what?
Jul 27 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Geoff Soper | last post by:
I'm not quite sure if the answer to my question lies in the Apache or PHP realm. If I have a php script running on Apache which outputs a JPEG image such as...
1
by: relaxedrob | last post by:
Howdy All! I am really stuck with this one - I want to completely create a table within JavaScript and insert it into the document, with onMouseOut and onMouseOver handlers in the table rows. ...
3
by: AndyG | last post by:
I'm trying to mess about with a table using javascript. I'm deleting the current row then adding a new row and adding a couple of columns. I then want to add either a style attribute and add a...
7
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+...
2
by: Evan | last post by:
I have an aspx page that can take a minute or so to load because it loads images from a database. I want to open a window and show a "Please Wait" message page at the start and close it when the...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
28
by: Peter Michaux | last post by:
Hi, I'm playing with dynamic script insertion to make a request to the server for a JavaScript file to be automatically run when it arrives in the browser. It works but... The page caching...
4
by: jpdogg | last post by:
Hi all, I'll trying to tell the difference between the following three cases: <img alt="text string" /> <img alt="" /> <img /> I can do this in Firefox with the following code, where elem...
1
by: soms2m | last post by:
HELLO ALL, I want to fill the parent window height with respect to the sub window height which is loading using ajax (mootools). For example if the parent window height is normal and the loading...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.