Javascript Reference
Categories: tips

Examples of refresh/reload current page

@May 17, 2009, 7:02 a.m.
Demo 1: Goto special page after 2 seconds:
<meta http-equiv="refresh" content="2; url=" />

Demo 2: Refresh current page after 2 seconds:
<meta http-equiv="refresh" content="2" />

Demo 3: ASP server side:
Response.AddHeader "refresh", "1;URL="

Unfortunately <META> refresh has been considered as a bad action by Search Engine. Pages with meta-refresh are usually punished by SE.

Here is a SEO friendly refresh/reload solution:
<script type="text/javascript">setTimeout('location.reload()',2000);</script>

Or place codes in a file:
<script type="text/javascript" src="/yourfile.js"></script>

Or event wrap with document.write:
<script type="text/javascript">
document.write('<sc'+'ript ty'+'pe="text/jav'+'ascript" src="/yo'+'urfile.js"></scri'+'pt>');

Powered by Linode.