window.location methods,window.location.assign('url') - this will load a new document to the browser.
window.location.reload('true/false') - this will reload the current document.
window.location.replace('url') - load new page to the browser window.
What you have to do is simply assign the URL that you need to redirect to the window.location object. You can type any URL in the provided text box and check the redirect by click on "Redirect" button. Please make sure that you have to enter the URL in correct format. otherwise it will not work properly. If you want to redirect to another domain always use http://(Protocol) to the URL parameter. But you don't need to add http:// (Protocol) part to the URL redirect with locations in the same domain.
As a example, suppose that you have to redirect the user to different domain use following script.
If you need to redirect the user to the file in the same domain use following code to do that. As an example you have a list of news items in a page. You need to redirect the user to each detailed news item after the user clicks on "more' button.
window.location.reload(); //reload from cache folder
Reload This Page
Also you can use location.reload() method to reload the current document. This is similar to click browser's reload button. By default page will be reloaded from the browser cache. But you can force to reload it from the server by passing the parameter forceGet as true. It is similar to click ctrl+F5. What you have to do is simply pass true or false to reload() method.
window.location.reload(true); //reload from server
You can test this reload function by creating a simple HTML page with an image. Also you have to install firebug on your browser. First reload the page from cache and check http status. You can see 304 Not Modified. That means the page load from your browser's cache. Then use the forceGet parameter true for reload document from the web server. Again check the http status. It shows the 200 OK.
Also you can redirect the user to a new page using self.location. See how it works.
There is an another way for do the redirection. Here you can use top.location to redirect the page. Try bellow example.