The web is full of moving parts. Pages change, information updates, sessions expire, and users move between states. Developers often need a way to refresh the page automatically and one legacy expression used to achieve this is javascript:location.reload(true). But like many pieces of older JavaScript syntax, its meaning, usage, and relevance have changed over time.
This article explains what this expression is, how it works, what it once did, why it no longer behaves as expected, and what modern developers should use instead. It is written to feel natural and human, guiding you through context, history, and best practice.
What This Expression Actually Is
javascript:location.reload(true) is simply JavaScript code that tells the browser to reload the current page. Each part of it has a role:
javascript:This appears most often inside bookmarklets or in link attributes. It signals that what follows should be executed as JavaScript.locationA browser object representing the current page URL, part of the Window API.reload()A method that refreshes the page, much like pressing the browser’s refresh icon.trueA boolean once intended to force the browser to reload from the server instead of from cache.
When combined, the line attempts to refresh the page and request all resources freshly.
How Reloading Works in JavaScript
The standard method to refresh a page is:
location.reload();
Calling reload() triggers a complete page refresh. The document, styles, scripts, and images are torn down and reloaded. From a user’s perspective, this is the same as hitting the refresh button.
Browsers decide on their own whether they fetch files fresh or reuse cached versions. That decision is based on server cache headers, browser settings, and developer tools cache preferences.
What About the trueParameter?
Historically, older browsers interpreted location.reload(true) as a request to “force reload from the server”similar to pressing Ctrl + F5 on the keyboard.
In that era, browsers treated the boolean argument as a flag. Setting it to true would ask for fresh content directly from the server.
Over time, this behavior became inconsistent and unreliable. Not all browsers respected it, and its implementation never became part of any recognized standard.
Why the Feature Is Deprecated
Modern browsers Chrome, Firefox, Safari, Edgeno longer consider that boolean argument. It is ignored. Today, location.reload(true) behaves identically to location.reload().
There are three main reasons it is now outdated:
- The HTML and DOM specifications never officially supported a cache‑bypass argument.
- Browser vendors phased out inconsistent and non‑standard features for reliability.
- Server‑side cache headers now offer a cleaner and more controlled approach.
Its presence remains mostly in old code examples and outdated tutorials online.
How Browsers Actually Decide What to Reload
When a reload occurs, the browser evaluates whether to grab files from cache using several signals:
- Cache‑Control headers such as
no‑storeormust‑revalidate. - E‑Tags and Last‑Modified timestamps to check if a cached copy is still valid.
- Local browser settings and developer tools toggles such as “Disable cache.”
JavaScript alone cannot reliably override these which is why reload(true) faded out.
Is It Still Useful at All?
Even though the boolean no longer has power, the idea of refreshing a page still matters. Developers might need a reload when:
- A user has completed a form and new content should appear.
- A logout action requires clearing temporary data.
- A time‑sensitive dashboard must reflect new information.
Reloading is simple but it comes at a cost. A refresh resets scroll location, removes unsaved text in forms, and momentarily interrupts the user experience. It should be used intentionally, not automatically or excessively.
Safer Modern Alternatives
Because reload(true) doesn’t guarantee a fresh result, developers now use different tools when freshness matters.
Adding a Cache‑Bust Query Parameter
window.location.href = window.location.pathname + '?refresh=' + Date.now();
This technique tells the browser that the URL is new, forcing a network request.
Controlling Caching at the Server Level
A developer can set headers like:
Cache‑Control: no‑store
This ensures no cached version is ever reused.
Refreshing Only What Needs Updating
Using JavaScript APIs such as fetch() allows refreshing a portion of page data instead of disrupting the entire screen.
Where Reloading Is Not Ideal
Modern web applications, especially Single‑Page Apps (SPAs), favor smooth transitions and minimal interruptions. These apps often refresh data silently in the background.
A full reload disappears from view more and more in modern UI design because users expect what is already on the screen to update without flicker or wait times.
In frameworks like React and Vue, state changes update only the affected components making reload unnecessary.
Common Missteps Developers Make
Because of its legacy presence online, many developers:
- Use
location.reload(true)expecting a guaranteed server reload. - Trigger reloads inside fast loops, accidentally overwhelming users.
- Forget that refreshing wipes user input.
- Rely on reload instead of targeted, smarter updates.
Reloading can be powerful, but it is not a substitute for thoughtful interaction design.
Practical Code Examples to Use Today
Refreshing on a button click:
<button onclick="location.reload()">Refresh Page</button>
Refreshing every 60 seconds:
setInterval(() => location.reload(), 60000);
Refreshing after an action completes:
function onSave() {
saveData();
location.reload();
}
These examples illustrate intentional usage instead of reflexive reloading.
Final Thoughts
javascript:location.reload(true) is more a historical footprint than an active tool. It teaches us how browsers once handled reloading but does not offer value in modern development.
The meaningful and standard option is simply:
location.reload();
Understanding what once worked and what works now helps prevent technical confusion. It preserves clarity for developers maintaining older systems and empowers cleaner solutions for applications being built today.
Reloading is not going away but how we do it continues to evolve. The more intentional and informed the approach, the better the experience delivered to the user.
FAQs
Does location.reload(true)still force a fresh reload?
No. Modern browsers ignore the true parameter, so using it doesn’t guarantee a server‑fresh reload.
What is the recommended way to refresh a page today?
The safest and most reliable option is simply calling location.reload(). It is standard and consistent across browsers.
Will a reload remove my typed text or scrolling position?
Yes. A full reload resets the page, which means unsaved text and scroll position may be lost.
Can I refresh only a section of a website instead of everything?
Yes. Using fetch(), partial rendering, or framework‑based state updates allows targeted refreshing without interrupting users.
When should a reload be avoided?
Avoid using reloads where users actively enter information or rely on continuity unless it is a deliberate action they trigger.











