在HTML中可以这样做:
<
meta
http-equiv
="refresh"
content
="3;url=http://192.168.102.28/bbs"
>
<!--3秒后跳转到http://192.168.102.28/bbs,如果不加url属性,则刷新自己。-->
Javascript方法:
<!--3秒后跳转到http://192.168.102.28/bbs,如果不加url属性,则刷新自己。-->
1
history.go(
0
)
2 location.reload()
3 location = location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL = location.href
C#以及asp方法:
2 location.reload()
3 location = location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL = location.href
1
Response.Redirect(url);
2 Response.write( " <script>window.location=window.location;</script> " );
需要知道的有几点:
2 Response.write( " <script>window.location=window.location;</script> " );
1、location.reload()与location=location是有差别的:在提交了页面之后前者的调用会导致页面再次被提交,而后者则重新加载提交之前的页面。
2、在c#中的第二种方法本质上还是使用的Javascript方法。
3、这里并没有讲述用Javascript在框架结构或新开窗口情况下如何刷新,这些情况下的刷新也无非就是找到需要被刷新的窗口的location,再做相应处理,如使用parent或opener。