jQuery

Difference between window.location.href and location.reload

Share

window location href and location reload() both redirects a page to a new page but there are some difference to follow.

Here is the difference between window.location.href and location.reload:

window.location.href is not a method. It is a property which will tell you the current URL location of the browser. Changing the value of the property will redirect the page.

window.location.href = 'http://www.namasteui.com';

The window.location.reload() method is used to reload the current document. It acts same as the reload button in our browser.

window.location.reload() is supposed to accept the argument that tells to do hard reload from the server by setting the forceGet parameter to true i.e. ignoring the cache.

window.location.reload(true);

Another thing is that window.location.reload() reloads the current page with POST data, whereas window.location.href = window.location.href does not include the POST data.

View Comments

  • The information you are providing is very helpful for me and other curious readers also. I love to read articles.
    Thank You.

Recent Posts

Editorial Elevation: Refined Writing Services

Introduction The influence of words is more significant than ever in a digital age. Whether…

2 days ago

How to Start a Business?

How to Start a Business begins with the realization that every business has its risks and…

2 days ago

4 Tips for Businesses Struggling with Cash Flow

It's not uncommon for businesses to have financial difficulties nowadays. The fact of the matter…

3 days ago

Top Advantages of Augmented Reality in Healthcare

The success of any tech innovation depends on its share in various industries and business…

3 days ago

Recover From Google Penalties in 10 Steps in 2024

Facing Google penalties can be a daunting challenge for businesses relying on organic search traffic.…

3 days ago

What is the Future of Artificial Intelligence?

Technology, undeniably, has made our lives easier. But the advent of artificial intelligence has been…

3 days ago