Closed
Bug 531441
Opened 15 years ago
Closed 15 years ago
dynamically created images bypass browser cache
Categories
(Core :: Networking: Cache, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 497665
People
(Reporter: cicovec, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
when an image is created dynamically (does not matter if via document.createElement, new Image(), parentNode.innerHTML or img.cloneNode) the browser cache is bypassed, and the image loads from src url
testcase can be found in "Steps to Reproduce" section
I tried to fiddle around with image.cache prefs, with no luck
Reproducible: Always
Steps to Reproduce:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Image Preload Test</title>
</head>
<body>
<div id="div"><img id="img" src="http://test.thecodecentral.com/demos/imageloader/Tree.jpg" alt="" /></div>
<div id="div2"></div>
<script type="text/javascript">
<!--
document.getElementById('img').onload = show;
function show() {
document.getElementById('div').style.border = '10px solid red';
document.getElementById('div2').innerHTML = '<img src="http://test.thecodecentral.com/demos/imageloader/Tree.jpg" alt="" />';
}
//-->
</script>
</body>
</html>
Actual Results:
if the image is not yet in the cache, it loads from the server, and the copy is read from server (which is the expected behavior), but if you press Ctrl+F5, first the original image is downloaded, onload event is fired and the second image starts to load from the server (unexpected)
Expected Results:
the first image should be loaded from the server
the second image should be loaded from browser cache
- occurs in Firefox 3.6 beta 1 as well
- I have tried this with clean empty profile directory, so extensions are not involved
the code works as expected in Safari 4, Chromium 4, Opera 10.10 Beta, IE 8 (all available compatibility modes)
Updated•15 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•