3 Replies Latest reply on Sep 29, 2010 4:48 AM by rootsounds

    Clear the cache in browser

    satyasuppu Level 1



        Please help me how to clear the catche using flex..



         In my application i have one combo box with 3 values and "Go" button


          User will select one value from that combo and click on Go button..It will open a new window ,which is poinintg to BI publisher reports.while opening  URL in a window i am passing userid and password in my application..So that the window will directly points to reports..


        when i select another value from combo and click on Go button ..it will open report related to the selection..this time iam passing diff userid and password..But its not opening the latest report which i selected..its showing the previously opened report with the old userid adn password....

      when it points to BI publisher report we have an option at the right hand side to Sign out..If i sign ont/clear the cache of the browser and select diff value from combo its showing the correct report..If i will not signout/not clear the cache its showing correct report..

      how can i clear the cache in flex application...Please help me out on this..Please tell me is there any other way to get coorect reports..Here i am attached the code whioch i have written..Please help me...


      public function generateReport():void
                   var uv:URLVariables = new URLVariables();


                           Alert.show("Please select a report from Report Combo");
                   if(repcombo.selectedItem.label=="HWBOM Reports")
                           uv.id = "hw_user";
                          uv.passwd = "hw_user";
                   if(repcombo.selectedItem.label=="Labor BOM Reports")
                              uv.id = "lab_user";
                          uv.passwd = "lab_user";
                    if(repcombo.selectedItem.label=="Storage & Server Reports")
                             uv.id = "st_user";
                          uv.passwd = "st_user";
                     var baseurl:String="http://Link to open the report/";
                      var url:URLRequest = new URLRequest(baseurl);
                       url.method = "POST";   
                      url.data = uv;



      Please help me...

        • 1. Re: Clear the cache in browser
          rootsounds Level 4

          Flex cannot clear the cache, but neither can JavaScript. This would be a major problem.


          I'm not sure if this is what you are describing, but there are definitely caching issues that some browsers have when url parameters are involved. If you pass the same url parameters, it will return a cached page. If this is not the behavior that you want from your service, then you have to make sure that it is sending out the appropriate headers to signal the browser that it should not cache the page. If you can't modify the service, a workaround is to add another parameter with a randomly generated value (this makes the url as a whole unique).

          1 person found this helpful
          • 2. Re: Clear the cache in browser
            satyasuppu Level 1




              Thank you so much for your reply..


              I have tried by passing the info to not to cache the data in browser by using below code.


              requestHeaders["Pragma"] = "no-cache";
              requestHeaders["Cache-Control"] = "no-cache";


            I am passing this info before calling navigateToURL method...But its not working..Still caching the data.


            Can you please tell me how to add another parameter with a randomly generated value to the URL..Please help me.


              Not able to find any solution for this problem..





            Thanks inadvance..

            1 person found this helpful
            • 3. Re: Clear the cache in browser
              rootsounds Level 4

              The combination described here does the trick for me: