Jump to content

Javascript Keycode Help


programming.name

Recommended Posts

Hi,

 

Is that possible to implement an effect that F11 key is pressed automatically on load?

 

I mean I'm trying to maximize the window and I don't want to actually resize the window with the window object.

 

I rather to use the keycode to get the same effect as if I press the F11 key manually to "REALLY" maximize the window. (with auto-hide-and-show address bar)

 

I want to return the value of keycode on load and I found that most browsers'(at least my target browsers) value for F11 is 122.

 

So I tried the following:

 

test.html

 

<body onload="return max_win(event)">

 

 

test.js

 

function get_keycode(e)

{

if (window.event)

{

keycode=event.keyCode;

}

else

{

keycode= e.which;

}

}

 

function max_win(e)

{

get_keycode(e);

return keycode=122;

}

 

It does nothing. can anyone fix my problem please?

 

Thanks inadvance.

Link to comment
Share on other sites

## I apologize in advance for the following rant. ##

 

Even if it could I would avoid your site like the plague. My own company does that with several of our web applications and it annoys the hell out of me. It's my freakin' browser, if I want it maximized I'll do it myself. It strikes me as pure arrogance that a site feels that their application is so important that it should be viewed full screen for me. WTF? I have very large monitors - depending on what system I'm using - and if the site is built to work with moderately sized monitors (as it should) then making it full screen for me is going to mostly display empty space. It would be like having a TV that uses PIP (Picture In Picture) and when a commercial comes on it detects that it is running in a small window and decides for me that it is more important and should take up the full screen.

 

Leave my freakin' browser window alone.

Link to comment
Share on other sites

lol .. what Psycho said pretty much. I mean, it's possible to rig up a way to make it about the same, but it would just be annoying as hell, and my screen is big enough that most sites are quite small anyways. You can give a message to fullscreen it by pressing F11, but forcing it is a dick move. I don't even use my browser maximized because of all the empty space. I have room for other applications beside it, and I don't want the browser to cover them up on its own. If I did, I would do it myself.

 

If you really must for some reason which I don't think exists .. You could open a window with no toolbars and whatnot, set the location of the browser to hide the top and then fill the rest of the screen. You would have to guess on the height of the window bar, and here in Linux, it won't let you set it that high so you would be putting some window below the screen. You would be better off just allowing the title bar to be there and making the window the size of the screen, but again .. this would still drive me nuts and I wouldn't bother to use your site. If I really had to use the site, I would make a plugin to change it or open the URL in a new tab myself and bookmark it.

 

Otherwise .. you shouldn't do it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.