You must Sign In to post a response.
  • Category: JavaScript

    How to open poupwindow in full Screen on button click like We press F11

    how to open poupwindow in full Screen on button click like We press F11

    i have a link or button onclick i want to open popup window in full screen. we F11 in browser.

    thank u
  • #754445
    Hi,

    Plz try in latest versions of Chrome, Firefox and IE(11).below JS code for as per your requirement:

    1: Js code:

    function toggleFullScreen(elem) {
    // ## The below if statement seems to work better ## if ((document.fullScreenElement && document.fullScreenElement !== null) || (document.msfullscreenElement && document.msfullscreenElement !== null) || (!document.mozFullScreen && !document.webkitIsFullScreen)) {
    if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || (document.mozFullScreen !== undefined && !document.mozFullScreen) || (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) {
    if (elem.requestFullScreen) {
    elem.requestFullScreen();
    } else if (elem.mozRequestFullScreen) {
    elem.mozRequestFullScreen();
    } else if (elem.webkitRequestFullScreen) {
    elem.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
    } else if (elem.msRequestFullscreen) {
    elem.msRequestFullscreen();
    }
    } else {
    if (document.cancelFullScreen) {
    document.cancelFullScreen();
    } else if (document.mozCancelFullScreen) {
    document.mozCancelFullScreen();
    } else if (document.webkitCancelFullScreen) {
    document.webkitCancelFullScreen();
    } else if (document.msExitFullscreen) {
    document.msExitFullscreen();
    }
    }
    }


    2:HTML code:
    <input type="button" value="click Button for fullscreen" onclick="toggleFullScreen(document.body)">

    here just call the JS function, when click the button for Full screen.


    3: One other thing to note is that these "full screen" commands don't have a vertical scrollbar, you need to specify this within the CSS:

    *:fullscreen
    *:-ms-fullscreen,
    *:-webkit-full-screen,
    *:-moz-full-screen {
    overflow: auto !important;
    }

    note: if u want vertical scorll bar then just call the css class inside the html tag..

    hope this code helpful for UUU..

    Thanks,
    chitaranjan


  • Sign In to post your comments