1

I'm working on a simple "Dead Pixel Finder" webpage. I have code that works in Firefox Quantum, but not in Chrome.

In the script section I have code that enables Fullscreen API when page is clicked. And it works fine in Firefox Quantum.

....

    <style type="text/css">
        div
        {
            height: 100vh;
            width: 100wh;
            background-color: red;
        }       
    </style>

</head>
<body>
    <div id="box" onclick="full_screen();"></div>
</body>

But in Chrome I get a black page, not the color I set for background color?

Dacobi
  • 417
  • 4
  • 14

1 Answers1

0

I am not sure what kind of API you are using there but check this out:

https://jsfiddle.net/cwoz3qw1/1/

 div {
   height: 100vh;
   width: 100vw;
   background-color: red;
 }


let i = document.querySelector('#box');

i.addEventListener('click', () => {

  if (i.requestFullscreen) {
    i.requestFullscreen();
  } else if (i.webkitRequestFullscreen) {
    i.webkitRequestFullscreen();
  } else if (i.mozRequestFullScreen) {
    i.mozRequestFullScreen();
  } else if (i.msRequestFullscreen) {
    i.msRequestFullscreen();
  }
});


More info:

https://www.sitepoint.com/use-html5-full-screen-api/

Alex
  • 2,651
  • 2
  • 25
  • 45