0

Got one easy question for you, but still hard for me... All i'm trying to do, is maximize new, opened window with different button...But it doesn't work, cant figure out why .. can someone please tell me, what i do wrong?

<form>
 <input type="button" value="Create New Window" onclick="createWindow()" />
 <input type="button" value="Maximize New Window" onclick="maximizeWindow()" />
</form>
var maxWindow;
 function createWindow(){
 var winWidth = 300;
 var winHeight = 100;
 var winLeft = (screen.width - winWidth)/2;
 var winTop = (screen.height - winHeight)/2;
 var winOptions = ",width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=" + winTop;
 maxWindow = window.open("http://www.google.com","newWindow",winOptions);
 maxWindow.focus();
 }
 function maximizeWindow() {
 maxWindow.moveTo(0,0);
 maxWindow.resizeTo(screen.availWidth, screen.availHeight);
 maxWindow.focus();
 }
asked Sep 7, 2013 at 18:02

1 Answer 1

1
<script>
var maxWindow;
 function createWindow(){
 var winWidth = 300;
 var winHeight = 100;
 var winLeft = (screen.width - winWidth)/2;
 var winTop = (screen.height - winHeight)/2;
 var winOptions = ",width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=" + winTop+'fullscreen=yes';
 maxWindow = window.open("http://www.google.com","newWindow",winOptions);
 maxWindow.focus();
 }
 function maximizeWindow() {
 maxWindow.moveTo(0,0);
 maxWindow.resizeTo(screen.width, screen.height);
 maxWindow.focus();
 }
</script>
<form>
 <input type="button" value="Create New Window" onclick="createWindow()" />
 <input type="button" value="Maximize New Window" onclick="maximizeWindow()" />
</form>

i add this to first function 'fullscreen=yes' and in second function change second line with my code maxWindow.resizeTo(screen.width, screen.height);

answered Sep 7, 2013 at 18:19
Sign up to request clarification or add additional context in comments.

4 Comments

please don't submit "spot the difference" answers.
i add this to first function 'fullscreen=yes' and in second function change second line with my code maxWindow.resizeTo(screen.width, screen.height);
so put that in your answer!
I believe the question is how to maximize new, opened window with different button. This code instantly maximizes the window on the first button click. I do not think that this will work for the OP.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.