Location: reload()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Please help us by answering a few questions.
El metodo location.reload()
carga de nuevo la URL actual, como lo hace el boton de Refresh de los navegadores.
La recarga puede estar bloqueada y arrojar un SECURITY_ERROR
DOMException
. Esto sucede si el origin de la llamada location.reload()
difiere del origen de la página que posee el objeto Location
. Consulta Same-origin policy para mayor información.
Syntax
location.reload();
Ejemplo
HTML
html
<button id="reload">Click para recargar</button>
JavaScript
js
const reload = document.getElementById("reload");
reload.addEventListener("click", (_) => {
// el _ es para indicar la ausencia de parametros
location.reload();
});
Especificaciones
Specification |
---|
HTML # dom-location-reload-dev |
Compatibilidad con navegadores
Report problems with this compatibility data on GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
reload |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- See implementation notes.
- User must explicitly enable this feature.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Ver también
- The
Location
interface it belongs to. - Similar methods:
Location.assign()
andLocation.replace()
.