Salut,
Exista o posibilitate sa fac din aplicatie full screen la un browser? De obicei la oricare browser nu pot din setari sa scot linia de sus. Am incercat din setting dar intotdeauna mai ramine ceva pe ecran. Imi trebuie pentru a afisa din aplicatie un tabel html pe un televizor smart intr-o hala de productie.
Ma gindesc la o functie JS care sa fie echivalenta actionarii tastei F11. Dar nu stiu daca F11 functioneaza la televizoarele smart.
Multumesc.
Full screen la browser cu javascript
-
- Mesaje: 430
Full screen la browser cu javascript
MarPlo
Mesaje: 4343
Salut
Exista fullscreen API in JavaScript, se foloseste functia requestFullscreen(), documentatie: Using fullscreen mode.
- Functioneaza la declansarea unui eveniment generat de utilizator, precum "click".
Exemplu:
Demo:
Exista fullscreen API in JavaScript, se foloseste functia requestFullscreen(), documentatie: Using fullscreen mode.
- Functioneaza la declansarea unui eveniment generat de utilizator, precum "click".
Exemplu:
Cod: Selectaţi tot
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Title</title>
<style>
#dv1 {
width: 100%;
height: 100%;
margin: 2px auto;
background: #f8f9fe;
border: 2px solid #33f;
padding: 7px;
text-align: center;
}
</style>
</head>
<body>
<div id="dv1">Click on the button, will display the content of this Div in fullscreen:<br/>
https://coursesweb.net/</div>
<button id="btn1">Full-Screen</button>
<script>
var elem = document.getElementById('dv1');
function fullScreen(elm){
if(elm.requestFullscreen) elm.requestFullscreen();
else if(elm.msRequestFullscreen) elm.msRequestFullscreen();
else if(elm.mozRequestFullScreen) elm.mozRequestFullScreen();
else if(elm.webkitRequestFullscreen) elm.webkitRequestFullscreen();
}
document.getElementById('btn1').addEventListener('click', function(){ fullScreen(elem);});
</script>
</body>
</html>
Click on the button, will display the content of this Div in fullscreen:
https://coursesweb.net/
https://coursesweb.net/