Which of the following method is used to refresh the webpage in JavaScript?
2018
Which of the following method is used to refresh the webpage in JavaScript?
- A.
window.reload()
- B.
location.reload()
- C.
window.refresh()
- D.
page.refresh()
Attempted by 183 students.
Show answer & explanation
Correct answer: B
Answer: location.reload() Explanation: The location.reload() method reloads the current webpage, similar to clicking the browser's Refresh button.
Equivalent forms: you can call it as location.reload() or window.location.reload().
Force reload note: some older code uses location.reload(true) to force reload from the server, but support varies across browsers; do not rely on it for critical behavior.
Other ways to trigger a reload include setting location.href = location.href or using history.go(0), but location.reload() is the standard, clear method for reloading the page.
Incorrect choices: window.reload(), window.refresh(), and page.refresh() are not standard browser methods for reloading the current page.
Hindi explanation: location.reload() मेथड का उपयोग वर्तमान वेबपेज को रीलोड
A video solution is available for this question — log in and enroll to watch it.