how to run javascript Sendkey only once

Asked

Viewed 324 times

0

I’m making a page that when opening sends the F11 command by the javascript function Sendkey but need that this function only run once someone knows how to do it, follow the code below:

function requestFullScreen() {

var el = document.body;
//alert(el);
// Supports most browsers and their versions.
var requestMethod = el.requestFullScreen || el.webkitRequestFullScreen  || el.mozRequestFullScreen || el.msRequestFullScreen;
//alert(requestMethod);
if(requestMethod) {
alert("TESTE1");
// Native full screen.
requestMethod.call(el);

}else if (typeof window.ActiveXObject == "undefined"){
    //alert("TESTE2");
    // Older IE.
    var wscript = new ActiveXObject("WScript.Shell");

    if(wscript !== null) {
        $("#body").one('onload', function() {
            wscript.SendKeys("{F11}");
        });


    }
  }
}

html

<body onload="getDados();enviarDados();requestFullScreen();" id="body">

My idea is to leave the full screen but the page needs to update several times with my code every time it updates it sends the F11 would have some way to send only the first time

  • Edit your question and put your code in the code tag. For your question I suggest you use local Storage and implement its logic. Reference: https://www.w3schools.com/html/html5_webstorage.asp

  • One more thing for you to read about what you want to do. https://stackoverflow.com/a/29282049/4312593

  • can already do thank you

No answers

Browser other questions tagged

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