Monday, February 28, 2011

Refresh entire page content when using nested frames or framesets

In order to refresh the entire page contents when using nested frames or framesets i.e the equivalent of pressing F5 button in the browser, just add the below line to any html control like anchor, button, etc. This line of code can be at any nested frame level and it will refresh the entire page contents.

top.location.href=top.location.href


That line is cross browser compatible. Tested in IE6 and Firefox 3.6

<input type="button" value="Refresh" onclick="top.location.href=top.location.href"/>

No comments: