Here the redirection types in javascript
window.location.href is not a method, it's a property that will tell you the current URL location of the browser. Changing the value of the property will redirect the page.
window.open() is a method that you can pass a URL to that you want to open in a new window. And window.open() will have some additional advantages. By using this window.open() can be passed additional parameters.
window.location.href example will take you to Google..
window.location.href = 'http://www.google.com';
window.open() example. This will open Google in a new window.
window.open('http://www.google.com');
By using below code reload to same page
window.location = window.location;
You might also like:
How to search text in string using php ?29-10-2017 php search string search |
Time Sorting Ascending or Descending Order in Javascript19-07-2017 Javascript ascending order descending order |
How to make an http request in node js14-03-2017 http module node js |
Remove last two characters from given string06-03-2017 substring javascript remove |
How to change background color and color to the text using javascript27-02-2017 css javascript colors |