---
title: "window.open()在IE设置 \"检查所存页面较新版本\"  为 \"自动\" 的缓存问题"
author: "Jasonliao"
date: "2009-04-03T11:51:40Z"
tags: ["ASP", "Cache", "IE", "JavaScript", "PHP"]
slug: "window-open-ie"
draft: false
lastmod: "2009-04-03T12:07:21Z"
id: 360641
url: "https://jasonliao.iteye.com/blog/360641"
---

在如下结构的frameset中：

&lt;frameset cols="\*,180"  frameborder="yes" border="0" framespacing="0"&gt;     
   &lt;frame src="&lt;%=baseURL%&gt;/listInfoTemplate.do?filterCode=InfoTemplate&tableViewCode=InfoTemplate&tableCode=InfoTemplate" scrolling="auto"  name="map"&gt;  
   &lt;frame src="&lt;%=baseURL%&gt;/searchCategoryTree.do?forward=template\_list" scrolling="auto" name="categoryTree"&gt;  
&lt;/frameset&gt;

我在categoryTree中的某个数节点点击的时候要改变map的内容。即执行下面的js方法：

function doTreeNodeClick(nodeId){  
 var url = "&lt;%=baseURL%&gt;/listInfoTemplate.do?filterCode=InfoTemplate&tableViewCode=InfoTemplate&tableCode=InfoTemplate&SEARCH\_FIELD\_CategoryId="+nodeId;   
 window.open(url,"map");  
 //parent.map.location = url;  
}

当IE设置为   "检查所存页面较新版本"   为   "自动"   的情况下,每次点击树节点都没有进去.do方法里。

 

在网上找到这个描述：

当IE设置为   "检查所存页面较新版本"   为   "自动"   的情况下    
  frame\_a下有一个GridView,用于填充数据    
     
  使用window.open("xxxx.aspx?value=1",   "frame\_a")来打开一个网页,当网页打开后,页面会自动缓存,再次打开时就同最早一次打开是一样的(缓存原因),如果这时在页面,鼠标右键点刷新,那么这个页面的数据会重新加载,并显示所要显示的目标内容(没再使用已缓存的页面)    
     
  使用&lt;a   href="xxxx.aspx?value=1"   target="frame\_a"&gt;测试&lt;/a&gt;时不论使用多少次都是正确的(没自动缓存页面,更没有使用缓存页面)    
     
  请问:    
  1,在使用window.open("",   "")的情况下如何处理    
      除以下几种方法外的方法:    
      (我在使用方法3时没有效果,例:window.open("xxxx.aspx?random()&value=1",   "frame\_a"))    
          1、在Asp页面首部加入    
          Response.Buffer   =   True      
          Response.ExpiresAbsolute   =   Now()   -   1      
          Response.Expires   =   0      
          Response.CacheControl   =   "no-cache"      
          Response.AddHeader   "Pragma",   "No-Cache"    
     
          2、在HtML代码中加入    
          &lt;HEAD&gt;    
          &lt;META   HTTP-EQUIV="Pragma"   CONTENT="no-cache"&gt;    
          &lt;META   HTTP-EQUIV="Cache-Control"   CONTENT="no-cache"&gt;    
          &lt;META   HTTP-EQUIV="Expires"   CONTENT="0"&gt;    
          &lt;/HEAD&gt;  

 

 PHP网页    
  header("Expires:   Mon,   26   Jul   1997   05:00:00   GMT");    
  header("Cache-Control:   no-cache,   must-revalidate");    
  header("Pragma:   no-cache");    
  JSP    
          response.setHeader("Pragma","No-Cache");    
          response.setHeader("Cache-Control","No-Cache");    
          response.setDateHeader("Expires",   0);    
  C#中禁止cache的方法！    
  Response.Buffer=true;    
  Response.ExpiresAbsolute=System.DateTime.Now.AddSeconds(-1);    
  Response.Expires=0;    
  Response.CacheControl="no-cache";  
      
          3、在重新调用原页面的时候在给页面传一个参数    
          Href="\*\*\*\*.asp?random()"    
     
          4、xxx.aspx.cs中:    
          Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);    
     
  2.有没有window.open(href,   target)替代方法?    
          要可以设置href及target,能在javascript中使用的

 

但我试着用这些方法都没成功，不知道哪里错了，最后只好直接用

parent.map.location = url;解决问题。

 

 

附：点击 在Internet 属性设置选项里的 查看文件 选项,你会发现里面有N多的文件,这些文件都是你浏览过的网站的文件,都保存在你的机子里,检查所存网页的较新版本 设置就是当你重新打开你以前打开的网站的时候,是直接从这个缓存打开网站,还是从新到服务器去打开网站,一般选择自动选项,当你第二次打开同一网站时,会先从缓存打开,如果缓存没有,会从新从服务器打开,这样在打开同一网站的速度会快很多~~~