Solved

How to disable the cache in Internet Explorer 7?

Posted on 2008-06-12
6
10,392 Views
Last Modified: 2013-12-08
Hi

We are using a dinamic YUI tree view for reflect a folder structure.
We are trying to delete nodes from the tree, but when the browser executes the following code:

oTreeView.removeNode(oCurrentTextNode);
oTreeView.draw();

the node is not removed from the tree. Seems to be a client side cache problem on IE 7 (Firefox works fine).

We are trying to use cache control on our asp and html codes:

Into the ASP
<%

Response.CacheControl = "no-cache, must-revalidate";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;
%>

into the HTML page
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

 but the issue persists

Below you will find the complete function that we are using for remove the node:

function DeleteNode(oTreeView , idNode) {            
                  
                  var callbackDelete = {
                              success : function(o) {
                                    //content.innerHTML = o.responseText;
                                    eval(o.responseText);
                                    
                                    if(isSuccessfulBL) {
                                    
                                          if(previusNode.labelElId == oCurrentTextNode.labelElId) {
                                                previusNode = null;
                                          }
                                          delete oTextNodeMap[oCurrentTextNode.labelElId];
                                          oTreeView.removeNode(oCurrentTextNode);
                                          oTreeView.draw();
                                          
                                          window.location = 'repository.asp';
                                          
                                    } else {
                                          getScreenResponse().innerHTML = messageBL;
                                          getScreenResponse().style.visibility = "visible";
                                    }
                                    //getScreenResponse().innerHTML = o.responseText;
                                    //getScreenResponse().style.visibility = "visible";
                                    //delete oTextNodeMap[oCurrentTextNode.labelElId];                        
                                    //oTreeView.removeNode(oCurrentTextNode);
                                    //oTreeView.draw();
                                    
                              },
                              failure : function(o) {
                                    //content.innerHTML = o.responseText;
                                    getScreenResponse().innerHTML = o.responseText;
                                    getScreenResponse().visibility = "visible";
                                    getScreenResponse().innerHTML = "CONNECTION FAILED! " + o.responseText;                         
                              }
                  } // End CallBackDelete
                  
                  // Connect to our data source and load the data
                  var url = "../../BussinessLayer/folder_BL.asp?" +
                                "<%=PARAM_ACTION%>"   + "=" + "<%=DELETE_FOLDER%>" + "&" +
                                "<%=PARAM_FOLDER_ID%>" + "=" + idFolder + "&"  +
                                "<%=USER_ID%>"        + "=" + <%= userId %> + "&" +
                                "<%=PARAM_BOOL_DELETE%>"     + "=" + "true";  
                                
                  var conn = YAHOO.util.Connect.asyncRequest("GET", url, callbackDelete);
            } // END DeleteNode()\

How to disable the cache in Internet Explorer 7?

Thanks
0
Comment
Question by:zoropoteame
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 15

Expert Comment

by:dosth
ID: 21771445
what you have is right, can you clear cache manulally one time and see it is caching?
0
 

Author Comment

by:zoropoteame
ID: 21771998
I delete a folder in the page,  I went to other page and back again and IE no refresh it,
then, I repeated the same process but clearing cache manulally and i can see the change.
definitely is a client side cache issue
0
 
LVL 1

Accepted Solution

by:
webfullcircle earned 250 total points
ID: 21857652
Add this at the end of your page (between </body> and </html>):

PS: Yes, I know this is illegal to all W3C HTML specs, but IE has a tendency to not follow standards. Once the page is loaded, IE will read this and then, it will not cache it.

<%
    /* Fix IE caching */
    if (Request.Browser.Browser == "IE")
    {
     %>
     <head>
<meta http-equiv="Pragma" content="no-cache">
</head>
<% } %>

Open in new window

0
 

Expert Comment

by:the_cyman
ID: 24817576
I think you need to do:
oTreeView.removeNode(oCurrentTextNode);
oTreeView.render();
oTreeView.draw();

You forgot to render before the draw.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question