0

I have faced a strange problem, when manipulating image, and iframe SRC-s in jQuery.

On handheld devices ( tested on Android/Chrome and iPad/Safari ) the src change simply doesn't reload the source with the actual content. This works like charm on any computer.

UPDATE:

My approach simplified as much as possible:

function decompress(){
    $("img.foo").attr("src",newsrc)); // where newsrc is http://foo.bar/img/foo.png
}

And I am calling this function this way $(window).on("load",function(){decompress();});

UPDATE:

I have seen this discussion: jQuery: HTML is not updated after manipulating <img src> paths , so I would like to make it clear, I am not using it on local, but on webserver, and the SRC-s are full URL-s through http:// protocol.

UPDATE:

I have tried to not use the image cache with the url request trick ( Refresh image with a new one at the same url ) with no avail. My code looked like:

o.attr("src",o.attr("src").replace("-300x168","?") + Math.random() );

with absolutely no changes in the functionality. Firefox, Chrome, Chromium, but even Safari, or IE8 does great job on computer. However, I cannot make iPad/Safari, or Android/Chrome work properly. I don't know, what the problem can possibly be, it might show up on more handheld devices as well.

UPDATE:

My full (related) actual function looks like this:

var ce=$("img[src*='-300x168']");
for(var i=0;i<ce.length;i++){
    var o=$(ce[i]);
    o.attr("src",o.attr("src").replace("-300x168","") + "?" + Math.random() );
}

Am I doing something wrong? How could I fix this?

István Pálinkás
  • 2,217
  • 7
  • 25
  • 50

0 Answers0