JavaScript
--
Questions
--
Followers
Top Experts
Simulate F11
Hi,
I want to simulate the F11 (expand the browser to fullscreen) from JavaScript .
I found the attached code that should trigger a key event and I changed the key to 122 but it doesn't work.
I want to simulate the F11 (expand the browser to fullscreen) from JavaScript .
I found the attached code that should trigger a key event and I changed the key to 122 but it doesn't work.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Not possible and you did not attach anything
I have written code previously which can on:ly do this by opening as a new window:
window.open(anyURL, '', 'fullscreen=yes, scrollbars=auto');
I did at the time also find code which could also close its parent window, but no longer have this as it was extremely browser version and crossbrowser sensitive. Therefore you can have a window open its own URIL in a new window and then close itself (in theory).
The problem is added to by tabbed browsing whereby new windows open in tabs according to client settings. Therefore you don't know what results such code will produce with the client, or how a particular platform might handle it.
Additionally it is not considered user-friendly to suddenly throw a full screen at the user as they obviously might be browsing you page with requirement to switch to other open apps at will.
In short you required code snippet is above, but your audience might not like or want it - losing visitors to your site.
Unless it is extremely vital (so you will need to KNOW your audience systems to KNOW it will work) then my advice is consider if you really need this.
window.open(anyURL, '', 'fullscreen=yes, scrollbars=auto');
I did at the time also find code which could also close its parent window, but no longer have this as it was extremely browser version and crossbrowser sensitive. Therefore you can have a window open its own URIL in a new window and then close itself (in theory).
The problem is added to by tabbed browsing whereby new windows open in tabs according to client settings. Therefore you don't know what results such code will produce with the client, or how a particular platform might handle it.
Additionally it is not considered user-friendly to suddenly throw a full screen at the user as they obviously might be browsing you page with requirement to switch to other open apps at will.
In short you required code snippet is above, but your audience might not like or want it - losing visitors to your site.
Unless it is extremely vital (so you will need to KNOW your audience systems to KNOW it will work) then my advice is consider if you really need this.
I don't see any code attached. Am I losing my eyesight?
Meanwhile, have you considered the response of a user who does not want web sites putting them in full screen mode, or changing any other of their preferences?
Cd&
Meanwhile, have you considered the response of a user who does not want web sites putting them in full screen mode, or changing any other of their preferences?
Cd&






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
fullscreen=yes no longer works since IE8 servicepack something
If you are on an intranet and you need fullscreen, consider kiosk mode
iexplorer.exe -k index.html
If you are on an intranet and you need fullscreen, consider kiosk mode
iexplorer.exe -k index.html
I don't want to open a new window.
i just offer the user an icon that he can click on that will simulate the F11 key.
Currently I just tell him to do it (when he clicks on the icon), but I saw in another site that they do it (I didn't see how the do it and I don't have the link to it).
The code that I found is
Â
i just offer the user an icon that he can click on that will simulate the F11 key.
Currently I just tell him to do it (when he clicks on the icon), but I saw in another site that they do it (I didn't see how the do it and I don't have the link to it).
The code that I found is
Â
jQuery.fn.simulateKeyPress = function(character) {
// Internally calls jQuery.event.trigger
// with arguments (Event, data, elem). That last arguments is very important!
jQuery(this).trigger({ type: 'keypress', which: 122 });
};
jQuery(document).ready( function($) {
// Bind event handler
$( 'body' ).keypress( function(e) {
//alert( String.fromCharCode( e.which ) );
//console.log(e);
});
// Simulate the key press
$( 'body' ).simulateKeyPress('x');
}); }
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Its not what I wanted.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
So if it was not what you wanted, then the answer was: Not possible, which is what I said from the beginning
JavaScript
--
Questions
--
Followers
Top Experts
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.