Allow alerts to happen when in full screen html?

556 Views Asked by At

I have a website, and theres an option in it to make it full screen. Here's the code to make it full screen:

    <script>
addEventListener("click", function() {
    var
          el = document.documentElement
        , rfs =
               el.requestFullScreen
            || el.webkitRequestFullScreen
            || el.mozRequestFullScreen
    ;
    rfs.call(el);
});
</script>

The problem is, when I show an alert to the user like so:

<script>
function theproblem(){
alert('Y');
//It gets out of fullscreen then.
}
</script>

Then it gets out of fullscreen, and then shows the alert. Is there some way to allow alerts when in full screen mode? Or is it not possible?

1

There are 1 best solutions below

0
On BEST ANSWER

The alert is prompted from the browser as the same with the fullscreen function. An alert have the purpose to stop everything and put the prompt over everything since it's an alert, you need to see it.