Forum Moderators: coopster

Message Too Old, No Replies

Forcing IE to refresh

The correct new loaded IMG will only show ok after refresh

         

henry0

10:31 pm on Aug 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My CMS works fine
however in order to properly view the newly loaded pic
IE should be refreshed

how can I code a forced refresh

thank you

regards

Henry

jatar_k

11:48 pm on Aug 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



how about a meta refresh?

henry0

11:35 am on Aug 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Jatar_k
thanks, but what do you think about the following that
I was just reading about
"Some search engines penalize pages that use a Refresh of a few seconds or less."

it is a matter of facts that in my case I need an almost immediate refresh

henry0

11:52 am on Aug 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well I guess I should use a "Header"
or/and ban robot from that section for it really does not need to be spidered

mattx17

4:06 pm on Aug 13, 2004 (gmt 0)

10+ Year Member



The best way to do it is to send a set of headers that tell the browser to not cache stuff...for example:

header("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Cache-Control: no-cache");
header("Pragma: no-cache");

Might be a bit overkill, but try doing it. I use it on a site that people are uploading images too, and before I put these up, the images sometimes wouldn't refresh in IE.

Hope this helps!

henry0

5:33 pm on Aug 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Mattx17,

I did not think enough when I mentioned using a header
I have already a header that is used in a bunch of other files and my Auth sessions too
so I cannot add a new one and cannot add that to the existing cause it won't make sense for the other scripts

henry0

5:45 pm on Aug 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Done!
I moved a few lines around and made it working

Henry

henry0

7:18 pm on Aug 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Still a problem with refresh:
as per previous sugggestions I had it working on my test bed
however it does not on my production server
Here is the closier of making it working I get

<?
header( 'refresh: 3; url=/chamber/chamber_members/pic_loader/loadmeup_dex_lft.php' );
?>

if I do
header( 'refresh: 3; url=/' );
it refreshes to the index page
but if I use the top code line it throws at me "indefined variable etc...."
which does not make sense since without the "refresh" the script works A OK!

I need to refresh the same very page in order to show the new loaded image

script sample
<<<
first the usual
<?
session_register("auth_user");
?>
then some HTML and PHP (some are inspired by "Birdman's thumbs maker" script that I adapted to work on a multiple users environment and load the path to a DB)
<html><head>

<title>Save image</title>
</head>
<body>

<form action="view_dex_lft.php" method="post">
<?php

function db_connect()
{
$result=@mysql_pconnect("****", "****", "****") or die ('I cannot connect to the database.');
etc....

then all the image resize etc...
and ends by

?>
<img src="../images/<?=$new_thumb?>" style="float: left" border=\"0\" /></a>

<input type="hidden" name="index_left_pic[<?=$num?>]" value="<?=$new_pic?>" />
</div>
<?php
}
?>
<input type="submit" value="Click to Save Image" />
</form>
</body>
</html>

Warboss Alex

7:23 pm on Aug 14, 2004 (gmt 0)

10+ Year Member



I dunno if this'll help you, but ..

<img src='pic.jpg?<?=md5(time())?>' /> makes sure the image is ALWAYS requested from the server, not from the browser cache, so you'd always get the most up-to-date one ..

Sorry if this isn't what you want, I confess I only skimmed over the posts..

henry0

7:48 pm on Aug 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



At thet point of the script
the img moved from client's machine to a dir on the server then will be saved and transformed in a thumb; its path will be loaded to the DB
So yes the img is called from server side