0

I am trying to switch the browser to full screen on document load. Among the various plugins available I tried to work with this. The API suggests that full screen mode can be entered like $(document).fullScreen(true);

The API works correctly on a button click. However, if I try to trigger the click via jQuery, it fails.

$(document).ready(function(){
        $('#wow').click(function(){
            $(document).fullScreen(true);
        });

        $('#wow').trigger('click');

    })

Tried to just do a $(document).fullScreen(true); on document.ready, it still fails. Both actually fail with a Full screen error.

Triggering the button manually works!

The example code provided has code like these:

 <button onclick="$(document).fullScreen(true)">Enter Fullscreen mode (Document)</button>

They work on manual clicks.

I am unable to understand why the same code fails to work if the event is fired programmatically.

Please advice.


EDIT:

I saw this link, which suggests that programmatic switching is "denied" [if i got it right]. So, is there any work-around for this?

Community
  • 1
  • 1
Mono Jamoon
  • 4,437
  • 17
  • 42
  • 64
  • 1
    It's a security restriction. You can't go around it without user interaction (installing browser extension, clicking on buttons etc) – JJJ Nov 08 '13 at 10:32
  • 1
    Your user must initiate the full screen switch. Therefore it works when done from a button click, but not automatically on document ready/window load. Just imagine all the annoying popup windows/ads we'd have if this would be allowed! Thank god it isn't! – HaukurHaf Nov 08 '13 at 10:34

0 Answers0