there is some function in javascript, php or xml to hide or lock the buttons of the header bar of nagedores

Asked

Viewed 23 times

2

I am making a page to validate an item but I would like this page to only close if the scanned item has right up to there works, however can not find any code to hide or lock the buttons of the title bar of the windows of the browsers because I wish the user could not close the window someone knows a formula to do this in some web language.

<script>     
function valid(){
 var grupo   = $("#grupo").val();
 var certo   = $("#certo").val();
 var familia = $("#familia").val();

    if(window.event.keyCode == 13){
        if(grupo != certo){
            document.getElementById('fail').style.display = "block";
            $("#grupo").val('');
        }else if(familia == 'T46S' || familia == 'T470' || familia == 'T480'){
            document.getElementById('kit').style.display = "block"; 
            document.getElementById('kit2').style.display = "block";
            $("#kit2").focus();
            document.getElementById('grupo').style.display = "none";
        }else{
            window.open('', '_self', '');
            window.close();
        }
    }
}
</script>
  • you can’t prevent all user actions, and wouldn’t recommend it, I bet you wouldn’t like it if a site hides the buttons on your browser’s toolbar :) , just to illustrate, xml is not a language, so it has no commands or actions, the actions to intervene in the user’s browser are made with Javascript

1 answer

1

Completely stopping the user is not possible. You can ask him a question for example.

window.onbeforeunload = function(e)

setTimeout(function() {
   $("#modal_24").modal("show");
}, 10);

var msg = "Antes de sair gostaria de responder a nossa pesquisa?";
e = e || window.event;

// Pro IE e Firefox anterior a versão 4
if (e) {
    e.returnValue = msg;
}

// Para Safari e Chrome
return msg;

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.