Need to Display a popup before page load if page is loading more than 3 seconds. Used below code but it displays popup if page load is less tahn 3 seocnds also. Popup need to displayed if the page loading takes more time not less time.
<script type="text/javascript">
setTimeout(fnShowPopup, 1000);
function fnShowPopup() {
var answer = confirm("It may take few time to open this docuemnt. Click YES if you want to open the docuemnt in native format or click on CANCEL to continue viewing the docuemnt")
if (answer)
window.open(NativeView())
}
</script>