开发者

PHP class that changes an image and reloads the page not displaying new image in Internet Explorer

开发者 https://www.devze.com 2022-12-29 07:13 出处:网络
I have a class that runs a function when the image is clicked on to display an additional image. This function produces a linked div tag that reloads the page with a set of variables that then produce

I have a class that runs a function when the image is clicked on to display an additional image. This function produces a linked div tag that reloads the page with a set of variables that then produces another image. The image is set as a background image on a large div tag behind the linked div tags to give the same effect as开发者_运维知识库 an image map but without using an image map or a SVG. This works perfectly in Chrome and Firefox but will not display the new image in Internet Explorer until you F5 the page again with the get variables in the URL?

Does anyone know how to fix this issue so that it works in IE the same as the other browsers?

Many thanks.


I have looked at this and it does not matter if I use the background-image:(someimage.png) or img src='someimage.png' because the image name remains the same but IE caches the image until a force reload is executed. Therefore I have changed the image name dynamically each time by using the following.

$str = explode(".", $iFilename);
$fName = $str[0] . "_" . mktime() . "." . $str[1];
$this->filename = $fName;

I am not sure if there is another way of doing this that does not involve changing the filename so I am open to suggestions?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号