Jump to content

Having to refresh my page a few times


Asheh

Recommended Posts

I have a clickable image which calls a javascript functon which inturn, calls some GET stuff on a different page.

 

My problem is it only works half the time, i think its to do with the sessions. Sometimes I have to click several times before the page changes to what i want, its very strange.

 

Im sure somone has come across this before?

Ash.

Link to comment
https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/
Share on other sites

I looked into this.

 

I believe its somthing to do with the caching of the image, which is a real pain the arse! Ive tried sending some headers to stop this but its still not fixing anything, i still have to click once, twice or even 3 times before it refreshes properly.. (i believe this might be time based..)

 

Anyway heres the page, click the images on the second column in IE then try firefox, notice the difference?

http://www.nngb-evaluation.co.uk/acrylic_new/

 

Is it the caching thats causing this? cause' headers dont seem to be fixing it!

 

Help!!

I have a clickable image which calls a javascript functon which inturn, calls some GET stuff on a different page.

My problem is it only works half the time, i think its to do with the sessions. Sometimes I have to click several times before the page changes to what i want, its very strange.

Im sure somone has come across this before?
Ash.

 

Post your code here.

and Asheh, it doesnt happen to me and i have the latest FF, have been using it for 2-3 years now ;)

Below is the code to call the javascript:

 

			<a href="#" onClick="postToIframe('<?=$_SESSION['plate']?>','<?=$_SESSION['custom_text']?>', '<?=$_SESSION['base']?>', '<?=$_SESSION['badge']?>', '<?=$file_list[$i]?>','<?=$_SESSION['ghost']?>');">
			<img src="image_library/borders/thumbs/<?=$thumb_loc?>" border="0" alt="<?=$folder_list[$i]?>">
			</a>

 

here is the javascript:

 

<script language="javascript">
function postToIframe(plate, custtext, base, badge, border, ghost)
{
   var URL = 'drawplate_iframe.php?';
   URL = URL + '&plate=' + plate;
   URL = URL + '&custom_text=' + custtext;
   URL = URL + '&badge=' + badge;
   URL = URL + '&border=' + border;
   URL = URL + '&ghost=' + ghost;

   parent.frames.plate_display.location.href = URL;
   parent.frames.plate_display.location.reload();
}
</script>

 

 

Here is the code which should expire the headers:

 

<?php
header("ETag: PUB" . time());
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time()-10) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() - 5) . " GMT");
header("Pragma: no-cache");
header("Cache-Control: max-age=1, s-maxage=1, no-cache, must-revalidate");
session_cache_limiter("nocache");

session_start();

Ok that was just a silly error i made :-) but you can still see that clicking the borders wont change the eventual image? some sort of cacheing is going on? ??? ??? ???

 

I have tried changing the URL with math.random(), im setting the caching headers etc.

 

What else could it be?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.