JavaScript window.location.reload(true)

 JavaScript window.location.reload(true)

What is window.location.reload?

In some cases we want to reload pages using JavaScript. 

How do we do it?

I'll bind the method to the button and get it to work. When the users click the button the method is invoked.

Is it deprecated?

It is not deprecated. You can still use it without the forceReload flag. It was a Boolean argument that could be supplied. This will reload the location of the window. Thus, refresh's the page.

<input type="button" value="Reload Page" onClick="window.location.reload();">

You can check the elaborate discussion here

Post a Comment