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

The Rise of NFTs: Exploring the Impact of Non-Fungible Tokens on the Digital Economy

NFTs, or Non-Fungible Tokens, are revolutionizing the digital economy. These unique digital assets, authenticated through…

51 mins ago

Unveiling the Truth: Is the Spread of Sinus Infections a Myth or Reality?

Sinus infections, impacting approximately 31 million Americans each year, represent a significant health concern stemming…

1 day ago

Best Exercises To Reduce Weight & Keep You Stronger & Fitter!

No doubt that balanced weight is the key to wellness. So, when it comes to…

1 day ago

ARTIFICIAL INTELLIGENCE: Advantages And Disadvantages? Everything You Need to Know

Pros And Cons Of AI: Artificial Intelligence directly translates to conceptualizing and building machines that…

2 days ago

Four common mistakes when picking an internet provider

We all live on the internet; we use it for everything. Thus, when it comes…

2 days ago

What Is Commonly Misdiagnosed as Pink Eye: Understanding Eye Conditions and Their Symptoms

Introduction: Pink eye, or conjunctivitis, is a common eye condition characterized by redness and inflammation…

2 days ago