N
N
Nikolai Vasilchuk2011-02-03 08:17:30
Browsers
Nikolai Vasilchuk, 2011-02-03 08:17:30

Emulate pressing F11 in a browser?

Tell me, is it possible to programmatically expand the browser to full screen, as it happens when you press F11?
You need to make a "Fullscreen" link on the site.

Answer the question

In order to leave comments, you need to log in

8 answer(s)
G
gro, 2011-02-03
@gro

I really hope that this is not possible.

V
Vitaly Zheltyakov, 2011-02-03
@VitaZheltyakov

window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');

H
homm, 2011-02-03
@homm

You've already been given a lot of advice that doesn't work for you, so I'll risk giving you one more: Make an application on flash.

M
Mikhail Davydov, 2011-02-03
@azproduction

In the standard way, i.e. via createEvent & initKeyEvent & dispatchEvent cannot be done. This code has no effect, although the event is sent, caught and the default action is not terminated.

document.addEventListener("keyup", function (e) {console.log(e)}, true);
var evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent(                                                                                      
                 "keyup",      //  in DOMString typeArg,                                                           
                  true,        //  in boolean canBubbleArg,                                                        
                  false,       //  in boolean cancelableArg,                                                       
                  null,        //  in nsIDOMAbstractView viewArg   
                  false,       //  in boolean ctrlKeyArg,                                                               
                  false,       //  in boolean altKeyArg,                                                        
                  false,       //  in boolean shiftKeyArg,                                                      
                  false,       //  in boolean metaKeyArg,                                                       
                  122,        //  in unsigned long keyCodeArg - 122 F11 key code,                                                      
                  0);         //  in unsigned long charCodeArg;  
var canceled = !document.body.dispatchEvent(evt);
if (canceled) {
    // A handler called preventDefault
    alert("canceled");
} else {
    // None of the handlers called preventDefault
    alert("not canceled");
}

I think many programmers would like a fullscreen button for HTML content. For example, YoutTube in HTML5 mode cannot go to full screen, I don’t think that they are dumber than a locomotive and could not make a full screen (maybe only at 100%x100% of the page), there may have been some reasons.
If you really need it, then dig in the other direction: look for solutions in Java, they wrote what can be done in Silverlight.
PS F11 works only under windows, under mac - ctrl+cmd+f or cmd+f

E
Eugene, 2011-02-08
@Methos

1. Make a button with the text "Full screen mode".
2. When you click on it with the mouse, display the prompt "press F11 on the keyboard."

X
xSus, 2011-02-03
@xSus

Met only for IE, here's a kind of "decent" example... bitbybit.ru/solution/109/

N
nutz, 2011-02-03
@nutz

IE can be launched with the -k option, then it will immediately be in full screen mode.

X
Xpeh, 2011-02-06
@Xpeh

If there was such a way, it would be a vulnerability: it would be possible to simulate the appearance of any system dialog on the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question