Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

451
Vistas
I want to make my div to full screen when page load in javascript

i am working with the javascript to display my div to full screen . i have a function which call on button click and my screen turns into full screen mode but i want the full screen on page load.

what i have tried is

function togglescreen(){
    var element = document.getElementById("video-container");
    element.requestFullscreen();
}
<button id="fullscreenBtn" onclick="togglescreen()">Full Screen</button>
<div id="video-container" width="1000" height="500"></div>

it works perfectly but i need full screen into my page load. i also tried

document.getelementbyId("fullscreenBtn").click();

but it's also not working.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It's not possible, it needs to be triggered by the device or user input. It'd be easily abused otherwise.

https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen

Note: This method must be called while responding to a user interaction or a device orientation change; otherwise it will fail.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda