is there any function in javascript, php or xml to hide or block buttons from the title bar of nagedores

2

I am making a page to validate an item but I would like this page to only close if the scanned item is right until it works, but can not find any code to hide or block the buttons in the title bar of the browser windows because I would like 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>
    
asked by anonymous 14.06.2018 / 21:19

1 answer

1

Preventing the user completely 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;

}

    
14.06.2018 / 21:25