app_offline.htm 这么用


    app_offline.htm 这个文件是当web站点在重新发布时.net 自动生成的。发布过程中所有对该站点的请求都会被重定向到此页面,所以经常看到:一个显示“This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.” 的页面。
    某日秋高气爽,就写了一个 app_offline.htm文件,主要实现:
    (a) 文字提示用户:服务器正在更新版本,请稍后...
    (b) 用一小段 javascript 实现了在客户端定时重新访问站点
    最后要求实施人员以后更新站点时,一定要先把这个文件拷贝到站点根目录下,然后就可以放肆的进行任何更新。更新完毕后,再将该文件移走(更该文件名也可行)。
    这样,当我们在更新WEB站点时,如果用户访问该站点,就会看到这个提示页面。并且这个页面在客户端自动的定时重新访问服务器,于是用户也不用手动去拼命刷新页面,或者重新访问正确的路径,只要等到服务器更新完毕,这个页面就会自动跳转到有效的站点页面。

☆ 关于app_offline.htm的作用可参考:
ExpandedBlockStart.gif 代码
<! 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 >
    
< meta  http-equiv ="Content-Type"  content ="text/html; charset=gb2312" />
    
< title > 提示页面 </ title >
    
< style  type ="text/css" >
        body
{  font-size : 12px ;   }
        div
{  text-align : center ;  padding-top : 30px ;  padding-bottom : 30px ;  height : 150px ;  line-height : 200% ;   }
    
</ style >
    
< script  type ="text/javascript" >
        
var  loadObj  =   null ;
        window.onload 
=   function () {
            loadObj 
=  document.getElementById( " loading " );
            
if (loadObj)
            {
                setInterval(
" window.location.reload() " 10000 );
                setInterval(
' loadObj.innerText = loadObj.innerText.length < 10 ? (loadObj.innerText + ">") : "" ' 800 );
            }
        }
    
</ script >
</ head >
< body  scroll ="no" >
< div  style ="text-align:center;" >
    
< fieldset >
        
< legend >< span  style ="color:Red" > 温馨提示 </ span ></ legend >
        
< div  id ="errorContainer"  style ="color:Blue" >
        服务器正在更新
        
< br  />
        请稍候
< br  />< span  id ="loading"  style ="color:Black" ></ span >
        
</ div >
    
</ fieldset >
    
</ div >
</ body >
</ html >

转载于:https://www.cnblogs.com/gavinchi/archive/2010/04/06/1705011.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值