Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

457
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!