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
Share on other sites

Well!

 

The page you are trying to call is in the same folder or in another? check all the variables  in the url by displaying the url as  alert message before it is going to another page.

 

if possible post your piece of code here.

 

Regards

Joshi.

 

Link to comment
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!!

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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();

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.