DO YOU NEED A CONTENT WRITER FOR YOUR BUSINESS?

Your One-Stop Solution for All Content Needs! Click here for more!
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.

Jacob Frazier

Based on United States, Jacob Frazier is a skilled JavaScript developer with over 8 years of experience. He is passionate about change and trying new things, both professionally and personally. He loves startups and is extremely proactive.

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

How Did The Restaurant Industry change In Post Pandemic Era?

The coronavirus outbreak has drastically changed the way we live our lives. Yes, that's absolutely…

2 days ago

A Guide To CPQ and How It Fuels Marketing and Sales

Sales and marketing teams help attract, convert, and retain customers to ensure an organization’s long-term…

1 week ago

Top Questions Asked About Invoice Financing Applications

Are you an owner of a small business who’s trying to come up with ways…

2 weeks ago

Complete Medical Guide to Blood Sugar Testing and Glucose Control

Introduction When patients bring me their lab reports, the confusion is almost always the same.…

3 weeks ago

6 Tips to Strategically Remodel Your Home

Are you excited about remodeling your house after a long time? Perhaps if you're planning…

3 weeks ago

Driving Finding Balance on and off the Mat: How Calm Awareness Supports Everyday

The practice of yoga teaches us to be present, patient and mindful of our decisions.…

3 weeks ago