본문 바로가기
JQUERY

iframe 클릭 이벤트 처리 - jquery

by zgabriel 2024. 8. 7.
728x90

iframe 안을 클릭했을 때 이벤트 처리방법

<!doctype html>

<html lang="en">

<!DOCTYPE html>

<html>

<head>

<title></title>

<script src="https://code.jquery.com/jquery-1.12.4.min.js">

<script type="text/javascript">

var detector = setInterval(function() {

var elem = document.activeElement;

if (elem && elem.tagName == 'IFRAME') {

alert("iframe click");

clearInterval(detector);

}

}, 100);

</script>

</head>

<body>

<iframe id='' src='https://tv.naver.com/embed/25698159?autoPlay=true' frameborder='no' scrolling='no' marginwidth='0' marginheight='0' WIDTH='544' HEIGHT='306' allow='autoplay' allowfullscreen ></iframe>

</body>

</html>

 

 

반응형