1. 객체 판별법

  - 사용할 객체의 지원 여부로 분기 처리

 

<video id="myvideo" width="640" height="360" controls poster="../img/chrome.jpg">

</video>

 

myvideo = document.getElementById("myvideo");

 

if(typeof myvideo.ontimeupdate == "object") {

//DOM Level 0 방식 : 비표준

myvideo.ontimeupdate = updateTime;

} else {

//DOM Level 2 방식 : 표준

myvideo.addEventListener("timeupdate",updateTime);

}

 

 

2. 브라우저 판별법

  - 접속한 브라우저의 종류에 따라서 분기 처리

 

console.log(window.navigator.userAgent);

'javascript' 카테고리의 다른 글

jquery에서 id, name, class 접근방법  (0) 2016.07.29
자바 스크립트의 이벤트 모델  (0) 2014.01.23
html5 관련 사이트  (0) 2014.01.23
URL 특수문자  (0) 2014.01.23
Posted by 무세1
,