From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../windoweventhandlers/onhashchange/index.html | 158 +++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 files/pt-br/web/api/windoweventhandlers/onhashchange/index.html (limited to 'files/pt-br/web/api/windoweventhandlers/onhashchange') diff --git a/files/pt-br/web/api/windoweventhandlers/onhashchange/index.html b/files/pt-br/web/api/windoweventhandlers/onhashchange/index.html new file mode 100644 index 0000000000..5cca998fbe --- /dev/null +++ b/files/pt-br/web/api/windoweventhandlers/onhashchange/index.html @@ -0,0 +1,158 @@ +--- +title: WindowEventHandlers.onhashchange +slug: Web/API/WindowEventHandlers/onhashchange +translation_of: Web/API/WindowEventHandlers/onhashchange +--- +
+
{{APIRef("HTML DOM")}}
+
+ +

O evento hashchange é disparado quando a hash da window muda. (ver {{domxref("Window.location", "location.hash")}}).

+ +

Sintaxe

+ +
window.onhashchange = funcRef;
+
+ +

ou

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

ou

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

Parâmetros

+ +
+
funcRef
+
Referência a uma função
+
+ +

Exemplo

+ +
if ("onhashchange" in window) {
+    alert("O browser têm suporte ao evento hashchange!");
+}
+
+function locationHashChanged() {
+    if (location.hash === "#algointeressante") {
+        algoInteressante();
+    }
+}
+
+window.onhashchange = locationHashChanged;
+
+ +

O evento hashchange

+ +

O evento hashchange disparado possui os seguintes campos

+ + + + + + + + + + + + + + + + + + + +
CampoTipoDescrição
newURL {{gecko_minversion_inline("6.0")}}DOMStringA nova URL para a qual a janela está navegando.
oldURL {{gecko_minversion_inline("6.0")}}DOMStringA antiga URL da qual a janela veio.
+ +

Especificações

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificaçãoStatusComentário
{{SpecName('HTML WHATWG', '#windoweventhandlers', 'GlobalEventHandlers')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5.1', '#windoweventhandlers', 'GlobalEventHandlers')}}{{Spec2('HTML5.1')}} 
{{SpecName("HTML5 W3C", "#windoweventhandlers", "GlobalEventHandlers")}}{{Spec2('HTML5 W3C')}} 
+ +

Compatibilidade dos Browsers

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suporte Básico5.0{{CompatGeckoDesktop("1.9.2")}} +

8.0

+ +

atributos oldURL/newURL não são suportados.

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