2012-04-25 105 views
0

我有一個web應用程序,當點擊一個鏈接時會打開一個新窗口。只要我這樣做,我的瀏覽器的緩存被清除。如果我不點擊鏈接,緩存仍然存在。在IE中從父窗口打開一個新窗口會清除父窗口的緩存

我已經嘗試了標準target="_blank"window.open的方法,它們都導致清除緩存。

以下是對其他人遇到相同問題但沒有解決方案的參考。

http://www.pcreview.co.uk/forums/problem-new-window-clears-cache-t693284.html

任何想法,爲什麼?

IE 7和8

+0

您如何測試緩存是否被清除? – dez 2012-04-25 19:27:12

+0

老實說,我正在調試應用程序,並在上一頁應該緩存的page_load上有一個斷點。 – 2012-04-25 19:28:20

+0

默認情況下,緩存不會在IIS中的動態內容中發生 - 您是否返回了正確的緩存控制標頭? – dez 2012-04-25 19:34:23

回答

0

這是爲我工作,嘗試,讓我知道:

HTML頁面1(父):

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="wpop1.aspx.vb" Inherits="pruebas_wpop1" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PRIVATE" /> 
    <title>Parent</title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
    <asp:TextBox runat="server"></asp:TextBox> 
    <a href="wpop3.aspx" target="_blank" >Popup</a><br/> 
    <asp:Button runat="server" Text="Button" /> 
    </div> 
    </form> 
</body> 
</html> 

代碼隱藏第1頁:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  

     Response.ExpiresAbsolute = DateTime.Now.AddDays(2D) 
     Response.Expires = 7200 
     Response.CacheControl = "PRIVATE" 

End Sub 

HTML頁面2(彈出):

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="wpop3.aspx.vb" Inherits="pruebas_wpop3" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>PopUp</title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
    This is the Popup Window. 
    </div> 
    </form> 
</body> 
</html> 
+0

這適用於Internet Explorer 8.0,啓用和禁用兼容模式。 – CoderRoller 2012-04-26 00:51:40