• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 394
  • Last Modified:

HTM/PHP refreshing problem

Hi,
I have a HTM file and PHP file. HTM file is actually redirected from PHP file. so in my PHP code says that

  header("Location: rich.htm?reportname=" . $_GET["reportname"]);

So rich.htm is a file where we have two IFRAMES where we load two HTMLS which we have created already, the problem here is when we load the IFRAME with the HTMLS created its being cached. When i do a CTRL+Refresh it loads the content properly.

to avoid this CTRL refresh where should i keep the code in PHP / HTML, in either case what is the code?

Regards,G.
0
gcmachel
Asked:
gcmachel
  • 3
  • 3
  • 2
1 Solution
 
sypderCommented:
Give this a try:

header("Location: rich.htm?reportname=" . $_GET["reportname"] . "&rtime=" . time());

You can also try adding this to your HTML code:

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
0
 
johanbarnardCommented:
Another HTML tag to try is:
<HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
0
 
johanbarnardCommented:
Sorry: <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
gcmachelAuthor Commented:
No Guys it didnt worked out. I am not sure why? Is there anyway we can make the IFRAMES to refresh its contents when its loading. This is what i am doing with IFRAME

<iframe class="mytext" width="100%" ID="mytext" height="200" src="temp/curr_temp.htm"></iframe>

So let me know what can be done in IFRAME as the above mentioned methods didnt worked.

many thanks,G
0
 
sypderCommented:
Try:

<iframe class="mytext" width="100%" ID="mytext" height="200" src="temp/curr_temp.htm<?php echo "?rtime=" . time(); ?>"></iframe>
0
 
gcmachelAuthor Commented:
Hi Sypder,
It was nice with you. It worked well. I am going to give you the whole points. Also will you please take your time to explain what it does. I am keen to know what does that PHP code likely to do in that place.
Many thanks in advance.
Regards,G.
0
 
sypderCommented:
I am glad it worked. Basically, the user is caching temp/curr_temp.htm, which is not what you want. But since you don't have control of this page, you can't control the refresh rules. The trick we are using is that:

page.html?myvar=1 is different than page.html?myvar=2

So, we need to insert a variable that is always changing. A good one for this is time(). Therefore, the user first requests:

temp/curr_temp.htm?rtime=234562832

Then 60 seconds later they return to the page. Now, they are requesting

temp/curr_temp.htm?rtime=234562892

As far as the browser is concerned, this is a different page, although for the end user there is no difference, since rtime has no real meaning. I hope that makes sense.
0
 
gcmachelAuthor Commented:
Thanks for the input.
Regards,G.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now