From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- .../windoweventhandlers/onhashchange/index.html | 165 +++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 files/es/web/api/windoweventhandlers/onhashchange/index.html (limited to 'files/es/web/api/windoweventhandlers/onhashchange') diff --git a/files/es/web/api/windoweventhandlers/onhashchange/index.html b/files/es/web/api/windoweventhandlers/onhashchange/index.html new file mode 100644 index 0000000000..282176df2b --- /dev/null +++ b/files/es/web/api/windoweventhandlers/onhashchange/index.html @@ -0,0 +1,165 @@ +--- +title: WindowEventHandlers.onhashchange +slug: Web/API/WindowEventHandlers/onhashchange +tags: + - HTML-DOM + - JavaScript + - Propiedades + - Referencia + - WindowEventHandlers + - eventos +translation_of: Web/API/WindowEventHandlers/onhashchange +--- +
+
{{APIRef("HTML DOM")}}
+
+ +

El evento hashchange se dispara cuando la almohadilla ha cambiado (ver {{domxref("Window.location", "location.hash")}}).

+ +

Sintaxis

+ +
window.onhashchange = funcRef;
+
+ +

ó

+ +
<body onhashchange="funcRef();">
+
+ +

ó

+ +
window.addEventListener("hashchange", funcRef, false);
+
+ +

Parámetros

+ +
+
funcRef
+
Una referencia a una función.
+
+ +

Ejemplo

+ +
if ("onhashchange" in window) {
+    alert("¡El navegador soporta el evento hashchange!");
+}
+
+function locationHashChanged() {
+    if (location.hash === "#somecoolfeature") {
+        somecoolfeature();
+    }
+}
+
+window.onhashchange = locationHashChanged;
+
+ +

El evento hashchange

+ +

El evento hashchange enviado, tiene los siguientes campos:

+ + + + + + + + + + + + + + + + + + + +
CampoTipoDescripción
newURL {{gecko_minversion_inline("6.0")}}DOMStringLa URL nueva hacia la cual la ventana está navegando.
oldURL {{gecko_minversion_inline("6.0")}}DOMStringLa URL anterior desde la cual la ventana navegó.
+ +

Especificaciones

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacionEstadoComentario
{{SpecName('HTML WHATWG', '#windoweventhandlers', 'GlobalEventHandlers')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5.1', '#windoweventhandlers', 'GlobalEventHandlers')}}{{Spec2('HTML5.1')}} 
{{SpecName("HTML5 W3C", "#windoweventhandlers", "GlobalEventHandlers")}}{{Spec2('HTML5 W3C')}} 
+ +

Compatibilidad en navegadores

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
CaracteristicaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Soporte Basico5.0{{CompatGeckoDesktop("1.9.2")}} +

8.0

+ +

los atributos oldURL/newURL no estan soportados.

+
10.65.0
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Soporte Basico2.2{{CompatGeckoMobile("1.9.2")}}9.011.05.0
+
+ + -- cgit v1.2.3-54-g00ecf