Asheh Posted March 28, 2007 Share Posted March 28, 2007 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 More sharing options...
Asheh Posted March 28, 2007 Author Share Posted March 28, 2007 Infact this actually only happens in FIREFOX, and not in IE. Whats the deal with this!? There must be a nice fix somewhere? Regards Ash.e Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216667 Share on other sites More sharing options...
joshi_v Posted March 28, 2007 Share Posted March 28, 2007 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 https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216672 Share on other sites More sharing options...
Asheh Posted March 28, 2007 Author Share Posted March 28, 2007 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 https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216673 Share on other sites More sharing options...
DeathStar Posted March 28, 2007 Share Posted March 28, 2007 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 https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216674 Share on other sites More sharing options...
DeathStar Posted March 28, 2007 Share Posted March 28, 2007 Oh yes. And i noticed that the image refreshes 2 times, not only once. First refresh the image has apeared. Second refresh the image refreshes. What with that? Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216675 Share on other sites More sharing options...
Asheh Posted March 28, 2007 Author Share Posted March 28, 2007 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 https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216677 Share on other sites More sharing options...
Greaser9780 Posted March 28, 2007 Share Posted March 28, 2007 If that doesn't work there is another solution. Add this to the url in the java part: URL = URL + "&sid=" + Math.random() This sets a random number for the cache so it is different everytime. Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216685 Share on other sites More sharing options...
Asheh Posted March 28, 2007 Author Share Posted March 28, 2007 Its getting wierder! http://www.nngb-evaluation.co.uk/acrylic_new/ On firefox, the image doesnt even display at all now! Help?! Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216701 Share on other sites More sharing options...
Greaser9780 Posted March 28, 2007 Share Posted March 28, 2007 Since you already have it in firefox use the error checker. It will tell you what is wrong. Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216707 Share on other sites More sharing options...
mjlogan Posted March 28, 2007 Share Posted March 28, 2007 http://www.nngb-evaluation.co.uk/acrylic_new/drawplate_iframe.php?&plate=NNGB&custom_text=NationalNumbers.Co.Uk&badge=none&border=green_normal.png&ghost=none shows up blank to me in firefox and IE7 gives the red cross Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216711 Share on other sites More sharing options...
DeathStar Posted March 28, 2007 Share Posted March 28, 2007 hmm... Try checking the errors. mjlogan it shows up for me(the submit) not the image Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216712 Share on other sites More sharing options...
Asheh Posted March 28, 2007 Author Share Posted March 28, 2007 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 https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216714 Share on other sites More sharing options...
Greaser9780 Posted March 28, 2007 Share Posted March 28, 2007 It does change the color of the border though. Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216717 Share on other sites More sharing options...
Asheh Posted March 28, 2007 Author Share Posted March 28, 2007 IT does for you?? on firefox??? What! howcome it doesnt for me? Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216721 Share on other sites More sharing options...
mjlogan Posted March 28, 2007 Share Posted March 28, 2007 kinda works for me in FF 2.0.3 just have to click it a few times. Link to comment https://forums.phpfreaks.com/topic/44615-having-to-refresh-my-page-a-few-times/#findComment-216724 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.