當(dāng)前位置: 首頁(yè)IT技術(shù) → ASP如何禁止刷新當(dāng)前頁(yè)面

ASP如何禁止刷新當(dāng)前頁(yè)面

更多

下面給大家介紹兩種關(guān)于ASP禁止刷新當(dāng)前頁(yè)面的方法,希望能幫助到大家。

方法1:

<%
Dim SplitReflashPage
Dim DoReflashPage
dim shuaxin_time
DoReflashPage=true
shuaxin_time=10
ReflashTime=Now()
if (not isnull(session("ReflashTime"))) and cint(shuaxin_time)>0 and DoReflashPage then
if DateDiff("s",session("ReflashTime"),Now())<cint(shuaxin_time) then
response.write "<META http-equiv=Content-Type content=text/html; charset=gb2312><meta HTTP-EQUIV=REFRESH CONTENT=3>本頁(yè)面起用了防刷新機(jī)制,請(qǐng)不要在<b><font color=ff0000>"&shuaxin_time&"</font></b>秒內(nèi)連續(xù)刷新本頁(yè)面<BR>正在打開(kāi)頁(yè)面,請(qǐng)稍候……"
response.end
else
session("ReflashTime")=Now()
end if
elseif isnull(session("ReflashTime")) and cint(shuaxin_time)>0 and DoReflashPage then
Session("ReflashTime")=Now()
end if
randomize timer
regjm=int(rnd*8998)+1000
%>

方法2:

<%
Dim URL
If DateDiff("s",Request.Cookies("oesun")("vitistime"),Now())<2 Then
URL=Request.ServerVariables("Http_REFERER")
Response.Write("<meta http-equiv=""refresh"" content=""2;URL="&URL&""">")
Response.Write("防刷新,兩秒后自動(dòng)跳轉(zhuǎn)")
Response.End
End IF
Response.Cookies("oesun")("vitistime")=Now()
%>

熱門(mén)評(píng)論
最新評(píng)論
發(fā)表評(píng)論 查看所有評(píng)論(0)
昵稱:
表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
字?jǐn)?shù): 0/500 (您的評(píng)論需要經(jīng)過(guò)審核才能顯示)