브라우저를 Chrome으로 사용하고 있는지 완벽하게 감지 할 수있는 웹 사이트가 있는데 완벽하게 작동합니다.알림에 맞춰 전체 페이지 팝업 메시지가 표시됩니다.
이 "요소"에 대한 코딩은 -
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
if(isChrome){
alert("Chrome is detected");
}
다른 요소는 투명 페이지 전체가 메시지를 팝업입니다. 이것은 HTML 단추를 사용하여 메시지를 활성화 할 때도 완벽하게 작동합니다. 하지만 자바 스크립트에서 버튼 클릭이 아닌 활성화 될 팝업이 필요합니다. 활성화하려면 위의 alert("Chrome is detected");
행에 있습니다. 이 요소에 대한 코드는 아래에 있으며 내 의미를 알 수 있습니다.
<!DOCTYPE html>
<head>
<style>
.button{ width: 150px; padding: 10px; background-color: #FF8C00; box-shadow: -8px 8px 10px 3px rgba(0,0,0,0.2); font-weight:bold; text-decoration:none;
}
#cover{ position:fixed; top:0; left:0; background:rgba(0,0,0,0.6); z-index:5; width:100%; height:100%; display:none;
}
#loginScreen{ height:380px; width:340px; margin:0 auto; position:relative; z-index:10; display:none; background-color: white; no-repeat; border:5px solid #cccccc; border-radius:10px;
}
#loginScreen:target, #loginScreen:target + #cover{ display:block; opacity:2;
}
.cancel{ display:block; position:absolute; top:3px; right:2px; background:rgb(245,245,245); color:black; height:32px; width:32px; font-size:30px; text-decoration:none; text-align:center; font-weight:bold; border-radius:36px;
}
</style>
</head>
<body>
<div id="top" align="center">
<!-- PLEASE DIRECT YOUR ATTENTION TO THE LINE BELOW -->
<a href="#loginScreen" class="button" id="thebutton">Click here to Log In</a> <!-- THIS IS HOW THE POP UP IS ACTIVATED BUT I NEED TO ACHIEVE THIS LINE IN JAVASCRIPT -->
</div>
<div id="loginScreen">
<span style="font-size:30px">Attention User!</span>
<a href="#" class="cancel" id="exitbutton">×</a>
</div>
<div id="cover" ></div>
</body>
</html>
도움이 될만한 정보가 있습니까? 이 경우는 true FUNC 감지 할 때 팝업을 열고 싶은 경우
window.location.href
어떻게 질문에 제목을 관련이 사용할 수 있습니까? – Teemu