Use Enter on F5

0

Good afternoon!

I have an iframe and it opens a system where you need to use F5 to enter.

I've tried some things but it did not work ... It does not interact with what's in the iframe.

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <style>
        iframe {
            /* Set the width of the iframe the size you want to transform it FROM */
            width: 640px;
            height: 525px;
            /* apply the transform */
            -webkit-transform:scale(0.25);
            -moz-transform:scale(0.25);
            -o-transform:scale(0.25);
            transform:scale(0.25);
            /* position it, as if it was the original size */
            position: absolute;
            left: 100px;
            top: -14px;
            zoom:75%;
        }
    </style>

    <head>

        <iframe src ="Meu_Site"/>

    </head>
    <body>
        $('body').keypress(function(e){
        alert(e.which);
        if(e.which == 113)
        {
        e.codepress == 13
        }
        });  
    </body>
</html>
    
asked by anonymous 13.07.2015 / 21:37

1 answer

0

Your code seems to have some errors. The <style> must be within <head> and the <iframe> must be within <body> .

I do not know if you have jQuery, but the code does not seem to have it, so I put the code in pure javascript.

The <script> must be inside the <iframe> page to work.

html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <style>
        iframe {
            /* Set the width of the iframe the size you want to transform it FROM */
            width: 640px;
            height: 525px;
            /* apply the transform */
            -webkit-transform:scale(0.25);
            -moz-transform:scale(0.25);
            -o-transform:scale(0.25);
            transform:scale(0.25);
            /* position it, as if it was the original size */
            position: absolute;
            left: 100px;
            top: -14px;
            zoom:75%;
        }
        </style>
    </head>

    <body>
        <iframe src="Meu_Site"></iframe>
    </body>
</html>

javascript:

<script>
top.document.onkeydown = function(e){
    //definir a tecla clicada
    var key = e.which || e.keyCode;

    //verificar se a tecla foi o F5 (116)
    if(key == 116) {
        //não deixar o navegador atualizar
        e.preventDefault();

        //(o seu codigo aqui...)
    }
}
</script>
    
14.07.2015 / 20:51