Sign in to follow this  
phido

How To Prevent Cahcing Of Charts On A Php Page?

Recommended Posts

Hello. I recently noticed my charts were being cached in IE explorer. As a result, visitors see the charts on their initial visit, but not on subsequent visits. The chart on are rendered on a PHP page as follows ...

 

  <div id="chartdiv" align="center">FusionCharts. </div>
  <script type="text/javascript">
     var chart = new FusionCharts("../charts/Line.swf", "ChartId", "750", "310", "0", "0");
     chart.setDataURL("data/99_001.xml");
     chart.render("chartdiv");
  </script>

 

How do I prevent IE from applying its cache so charts are rendedered on subsequent visits?

 

Thak you.

Edited by phido

Share this post


Link to post
Share on other sites

Hi,

 

Thanks for your mail.

 

Could you please pass us the code in PHP that you are using to render the chart?

 

Also could you please let us know, whether in subsequent visits you see the same chart or no chart at all. In case you wish to see a chart with expected change of data you would need to set cache killing query string along with the XML URL.

 

e.g., in PHP:

 

"data/99_001.xml?nocache=" . microtime()

Share this post


Link to post
Share on other sites

Thank you for the very fast reply. To clarify ... The page itself is a PHP page, but php is only applied to produce some content that is unrelated to FusionCharts. The charts are produced (fairly generically I'm presuming) as follows.

 

 

<head> 
<script language="javaScript" src="../jsclass/FusionCharts.js"></script>
</head>

<body>

 <div id="chartdiv" align="center">FusionCharts. </div>
  <script type="text/javascript">
     var chart = new FusionCharts("../charts/Line.swf", "ChartId", "750", "310", "0", "0");
     chart.setDataURL("data/99_001.xml");
     chart.render("chartdiv");
  </script>


  <div id="chartdiv2" align="center">FusionCharts. </div>
  <script type="text/javascript">
     var chart = new FusionCharts("../charts/Line.swf", "ChartId", "750", "310", "0", "0");
     chart.setDataURL("data/99_001a.xml");
     chart.render("chartdiv2");
  </script>



</body>

 

The charts are generally accessed via a UI on another page. A visitor with an empty cache will see the charts as expected. However, it seems that as long as the cache is not cleared (of the specific page's content) the visitor is presented with the FusionCharts placeholder when visiting the page. Once the cache is cleared the cycle repeats; i.e., upon visiting the page the chart is rendered as expected ... then until the cache is cleared the user sees the Fusioncharts placeholder.

 

This only seems to be happening in IE9. If IE9 settings are set to 'Check for newer versions of stored pages ... every time I visit the webpage' the FusionCharts content renders normally. For the sake of speed, this is not IE9's default setting; at least it wasn't on my installation. It is set to: 'Check for newer versions of stored pages ... automatically.' I doubt users will bother to change this.

 

Two images are attached (1) emptycacheview.png, and (2) fullcacheview.png.

 

Thanks again for the assistance.

post-6977-019670200 1300111752_thumb.png

post-6977-059913200 1300111762_thumb.png

Share this post


Link to post
Share on other sites

Attempted to implement the following ...

 

   <div id="chartdiv" align="center">FusionCharts. </div>
  <script type="text/javascript">
     var chart = new FusionCharts("../charts/Line.swf", "ChartId", "750", "310", "0", "0");
   <?php
    $micro = microtime();
    echo 'chart.setDataURL("data/99_001.xml?nocache= . $micro");'; ?>
     chart.render("chartdiv");
  </script>

 

.. but results are the same. Any thoughts?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this