Redirect and Reload Page Using JavaScript

by  
Share:
Setting default parameter to a function in javascript

If you want to redirect your page to another page or reload the page using JavaScript or jQuery, it’s just a one-liner code.

Reload current page in JavaScript

To reload current page use window.location.reload(); or you can try location.reload();as well.

Redirect to another page in JavaScript

To redirect page to any URL use window.location='http://google.com'; or you can try window.location.href='http://google.com'; as well. Replace google.com with your URL.

Get the latest updates directly in your inbox for FREE: Subscribe here

Share your feedback / let me know your doubts regarding this tutorial in the comment box given below.

Share:
Hasan

Shahrukh Khan (Hasan)

A software engineer who's a die-hard coder, blogger, dreamer and mentor with years of expertise in web development. Know more...

Related Posts

Parshv Shah on

thnks

it is very useful..

Reply
baby bed on

Do you mind if I quote a few of your posts as long as I provide
credit and sources back to your site? My website is in the exact same niche as yours and
my users would really benefit from some of the information you provide here.
Please let me know if this ok with you. Thank you!

Reply
Shahrukh Khan on

As long as you mention credits and proper backlink its OK. After all we all are trying to help. Best of luck. Do email me your website name or stay in touch.

Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.