Note that there are some explanatory texts on larger screens.

plurals
  1. POChrome reloading image when moving it from one element to another, Firefox and Internet Explorer simply *move* the image. How can I work around this?
    primarykey
    data
    text
    <p>If I have an image on the page that I want to move from one element to another, Firefox and Internet explorer simply <em>moves</em> the image, while Chrome actually re-pings the image source for content. How can I force Chrome to not re-ping the source, but just <em>move</em> the image from one container to another?</p> <p>I can confirm this by setting the image source to an Asp.NET MVC controller, and set a breakpoint to see when it's requested. Here is an example:</p> <p>MVC Controller:</p> <pre><code>using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Web.Mvc; namespace Web.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult ImgController() { // Set breakpoint in this controller Image i = Image.FromFile(@"C:\img.png"); MemoryStream ms = new MemoryStream(); i.Save(ms, ImageFormat.Png); return new FileContentResult(ms.ToArray(), "Image"); } } } </code></pre> <p>View:</p> <pre><code>@{ ViewBag.Title = "Index"; } &lt;img src="Home/ImgController" /&gt; &lt;div&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; setTimeout(function () { document.getElementsByTagName("div")[0].innerHTML = document.getElementsByTagName("img")[0].outerHTML; }, 5000); &lt;/script&gt; </code></pre> <p>When the page initially loads the breakpoint in the <code>ImgController</code> controller is hit, which is expected. But when the <code>setTimeout</code> javascript function is executed after 5 seconds, the breakpoint in <code>ImgController</code> is hit a second time <strong>only in Chrome</strong>. In Firefox and Internet Explorer the breakpoint is never hit because it just moves the element.</p> <p>I've also tried <code>appendChild</code>, and jQuery's <code>.html()</code>, both have the same result.</p> <p>How can I force Chrome to use the element it already has in the DOM instead of re-pinging the server for repeat content?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload