Tuesday, March 6, 2018

How to Refresh / Reload the Web Page



You can use JavaScript location.reload() method. This method accepts a boolean parameter. true or false. If the parameter is true; the page always reloaded from the server. If it is false; which is the default or with empty parameter browser reload the page from it's cache.

With true parameter


<button type="button" onclick="reloadPage();">Reload page</button> 
 <script type="text/javascript">
    function reloadPage(){
        location.reload(true);
    }
 </script> 

With defaultfalse parameter




<button type="button"  onclick="reloadpage()">Reload page</button>
<script="text/javascript">
function reloadpage() {
    location.reload();
}
</script>

Using jQuery

<button id="Reloadpage">Reload page</button>
        <script type="text/javascript">
        $('#Reloadpage').click(function() {
        location.reload();
         }); 
        </script>

Singleton Pattern

Singleton pattern is the simplest pattern in java and is under the creational pattern. some key points to use in singleton pattern. It is...