HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <img src="apple-products.jpg" alt="apple products" height="250" width="200"> <p>Click on the button to display the image in full-screen. Meanwhile, check your console (Press F12)</p> <button onclick="myFunction()">Click Me</button> <script> var fullScreen = document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled; var elem = document.getElementsByTagName("img")[0]; function fullscreenCheck(){ console.log(document.fullscreenElement); } function myFunction(){ if(fullScreen){ elem.requestFullscreen(); setTimeout(fullscreenCheck, 1000); } } </script> </body> </html>
OUTPUT
×

Save as Private