The JavaScript command javascript:location.reload(true)
is commonly used by developers to reload a webpage forcefully. Although it was useful in earlier versions of JavaScript, this method has evolved. In this article, we will explain its purpose, usage, and SEO-friendly alternatives in 2025.
Understanding location.reload()
in JavaScript
Before diving deep into the true
parameter, let’s understand the base function:
javascriptCopyEditlocation.reload();
This function reloads the current web page. By default, it performs a soft reload (from cache). It is used for:
- Refreshing data
- Resetting dynamic content
- Implementing manual refresh buttons
What Does javascript:location.reload(true)
Do?
In older browsers, adding true
inside the reload function like this:
javascriptCopyEditlocation.reload(true);
would force the browser to reload the page from the server, bypassing the cache. This is known as a hard reload.
Deprecated Usage in 2025
Is javascript:location.reload(true)
Still Valid?
No, in modern browsers (Chrome, Firefox, Edge), the true
parameter has been deprecated. Today:
location.reload()
without any parameter is enough.- Browsers no longer support the
true
argument.
SEO Best Practices with location.reload()
If you are building an SEO-friendly website, avoid unnecessary reloads unless required. Here’s why:
- Frequent reloads can increase bounce rate.
- Hard reloads may reset dynamic user sessions.
- Search engines do not like unpredictable behavior.
Recommended Approach:
Use reloads only when needed and always prefer:
javascriptCopyEditlocation.reload();
instead of deprecated syntax.
Use Case Examples
1. Reload Button in HTML:
htmlCopyEdit<button onclick="location.reload();">Refresh Page</button>
2. Reload After Form Submission:
javascriptCopyEditform.onsubmit = function() {
// your logic
location.reload();
}
Conclusion
The keyword javascript:location.reload(true)
still appears in developer forums and articles, but it’s important to know that the true
argument is outdated. In 2025, best practices suggest using location.reload()
alone. If you want to stay SEO-compliant and build efficient web apps, avoid deprecated methods.