Js、Asp返回按鈕、返回串連代碼

來源:互聯網
上載者:User

在網上找到的幾種返回方式,整理一下貼出來,需要的朋友可以直接使用哦!
js-返回按鈕 返回上一個曆史頁面  

連結返回:
<a href="#" onclick="javascript:history.go(-1)">返回</a>

按鈕返回:

<input   type="button"   name="back"   value="返回"   onclick="javascript:history.go(-1)">

onClick返回:

onClick="javascript:history.back();return false;"

Firefox,Firefox中必須添加return false;

onclick="javascript:history.go(-1);return false;"

------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Asp返回按鈕 返回上一個曆史頁面 

Asp返回:

 Response.Cache.SetCacheability(HttpCacheability.NoCache);

        Response.Expires = -1; 

        Response.AddHeader("pragma","no-cache"); 

        Response.AddHeader("cache-control", "no-cache");

        Response.CacheControl = "no-cache";

        Response.Cache.SetNoStore();

 

禁止緩衝 

   在我找到的許多方案中,其中有一種建議禁止頁面緩衝。具體是使用伺服器端指令碼,如下所示:

Response.Buffer = True ;

Response.ExpiresAbsolute = Now() - 1; 

Response.Expires = 0 ;

Response.CacheControl = "no-cache";

這種方法非常有效!它強制瀏覽器重新訪問伺服器下載頁面,而不是從緩衝讀取頁面。使用這種方法時,編程者的主要任務是建立一個會話級的變數,通過這個變數確定使用者是否仍舊可以查看那個不適合通過後退按鈕訪問的頁面。由於瀏覽器不再緩衝這個頁面,當使用者點擊後退按鈕時瀏覽器將重新下載該頁面,此時程式就可以檢查那個會話變數,看看是否應該允許使用者開啟這個頁面。

 例如,假設我們有如下表單: 

<% 

Response.Buffer = True 

Response.ExpiresAbsolute = Now() - 1 

Response.Expires = 0 

Response.CacheControl = "no-cache" 

If Len(Session("FirstTimeToPage")) > 0 then 

"使用者已經訪問過當前頁面,現在是再次返回訪問。 

"清除會話變數,將使用者重新導向到登入頁面。 

Session("FirstTimeToPage") = "" 

Response.Redirect "/Bar.asp" 

Response.End 

End If 

"如果程式運行到這裡,說明使用者能夠查看當前頁面 

"以下開始建立表單 

%> 

<form method=post action="SomePage.asp"> 

<input type=submit> 

二: <html> 

<head> 

<meta http-equiv="Expires" CONTENT="0"> 

<meta http-equiv="Cache-Control" CONTENT="no-cache"> 

<meta http-equiv="Pragma" CONTENT="no-cache"> 

</head> 

三:

<script language="javascript"> 

<!-- 

javascript:window.history.forward(1); 

//--> 

</script> 

四:

<A HREF="PageName.htm" onclick="javascript:location.replace(this.href); event.returnvalue=false; ">

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.