diff options
Diffstat (limited to 'files/ru/web/api/window/hashchange_event/index.html')
-rw-r--r-- | files/ru/web/api/window/hashchange_event/index.html | 84 |
1 files changed, 1 insertions, 83 deletions
diff --git a/files/ru/web/api/window/hashchange_event/index.html b/files/ru/web/api/window/hashchange_event/index.html index 84087f124c..948beedbad 100644 --- a/files/ru/web/api/window/hashchange_event/index.html +++ b/files/ru/web/api/window/hashchange_event/index.html @@ -68,89 +68,7 @@ translation_of: Web/API/Window/hashchange_event <h2 id="Совместимость_с_браузерами">Совместимость с браузерами</h2> -<p>{{ CompatibilityTable() }}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>5.0</td> - <td>{{ CompatGeckoDesktop("1.9.2") }}<br> - <small>Support for the <code>oldURL</code>/<code>newURL</code> attributes added in Firefox 6.</small></td> - <td>8.0<br> - <code>oldURL</code>/<code>newURL</code> attributes are not supported.</td> - <td>10.6</td> - <td>5.0</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>2.2</td> - <td>{{ CompatGeckoMobile("1.9.2") }}</td> - <td>9.0</td> - <td>11.0</td> - <td>5.0</td> - </tr> - </tbody> -</table> -</div> - -<p><br> - There are several fallback scripts listed on <a href="https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills" title="https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills">this page</a>. Basically those scripts check the location.hash at a regular interval. Here is a version that allows only one handler to be bound to the <code>window.onhashchange</code> property:</p> - -<pre class="brush:js;">(function(window) { - - // exit if the browser implements that event - if ( "onhashchange" in window.document.body ) { return; } - - var location = window.location, - oldURL = location.href, - oldHash = location.hash; - - // check the location hash on a 100ms interval - setInterval(function() { - var newURL = location.href, - newHash = location.hash; - - // if the hash has changed and a handler has been bound... - if ( newHash != oldHash && typeof window.onhashchange === "function" ) { - // execute the handler - window.onhashchange({ - type: "hashchange", - oldURL: oldURL, - newURL: newURL - }); - - oldURL = newURL; - oldHash = newHash; - } - }, 100); - -})(window); -</pre> +<p>{{Compat("api.Window.hashchange_event")}}</p> <h2 id="Похожие_события">Похожие события</h2> |