Using Enter in F5

Asked

Viewed 75 times

0

Good Afternoon!

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

I tried some things but it didn’t work... It doesn’t 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>
  • I wonder if anyone could help me in this matter! Thank you so much.

  • Could you explain better what the need is? How to use F5 to enter? F5 is a standard shortcut for the browser and even the operating system to perform an update of something.

  • In the collector system we will not use F5 to update, as it will do the d and <Enter function>

  • There will be several "F", F5 = <Enter> F8 = Back Page F2 = Exit

  • See if it helps you: http://stackoverflow.com/a/14707966/3497987

  • In the e.codepress == 13 use only an equal sign =

  • aldux - It wasn’t... I did what you said and it didn’t work..

Show 2 more comments

1 answer

0

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

I don’t know if you have jQuery, but the code doesn’t seem to have it, so I put the code in pure javascript.

The <script> must be inside the <iframe> 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>

Browser other questions tagged

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