[onhashchange] hash 를 감지하는 onhashchange.js Polyfill 라이브러리
Umc Projects/onhashchange 2016. 5. 13. 16:18 |onhashchange
onhashchange.js 를 방금 릴리즈 했습니다.
https://github.com/powerumc/onhashchange
onhashchange 기능이 제공되는지 여부를 감지하고, 이를 지원하지 않는 오래된 브라우저인 경우 Polyfill 을 지원합니다.
아래의 호환 브라우저 미만인 경우 onhashchange Polyfill 이 동작하게 됩니다.
Implemented event fields.
The dispatched hashchange event has the following fields:
Field | Type | Description |
---|---|---|
newURL | DOMString | The new URL to which the window is navigating. |
oldURL | DOMString | The previous URL from which the window was navigated. |
Browser compatibility
Desktop Mobile
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 5.0 3.6 (1.9.2) 8.0 10.6 5.0
Ref. https://developer.mozilla.org/ko/docs/Web/API/WindowEventHandlers/onhashchange
Example
<html>
<head>
<script type="text/javascript" src="onhashchange.js"></script>
<script>
window.onhashchange = function(e) {
alert("onhashchange");
}
</script>
</head>
<body>
<p><a href="#a">#a</a></p>
<p><a href="#b">#b</a></p>
<p><a href="#c">#c</a></p>
</body>
</html>
'Umc Projects > onhashchange' 카테고리의 다른 글
[onhashchange] hash 를 감지하는 onhashchange.js Polyfill 라이브러리 (0) | 2016.05.13 |
---|
댓글을 달아 주세요