I\'m wondering how to refresh/reload a page (or even specific div) once(!) using jQuery?
Ideally in a way right after the DOM structure
is available (c
Use this:
<script type="text/javascript">
$(document).ready(function(){
// Check if the current URL contains '#'
if(document.URL.indexOf("#")==-1)
{
// Set the URL to whatever it was plus "#".
url = document.URL+"#";
location = "#";
//Reload the page
location.reload(true);
}
});
</script>
Due to the if
condition, the page will reload only once.
Try this:
<input type="button" value="Reload" onClick="history.go(0)">