Solved

window.open to Make Popup Fill Available Screen Size

Posted on 2008-10-13
2
1,067 Views
Last Modified: 2008-10-13
In IE6, I want to make a JS popup automatically detect and fill the available screen (except for the Windows taskbar area at the bottom of the screen--I'm not looking for the IE "fullscreen" that literally covers the entire monitor).  I tried this:

function fullWindow() {
window.open('http://www.example.com', 'mywindow', config='width=screen.availWidth,height=screen.availHeight,left=0,top=0,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizeable=no');
}

But it only opens to about half of the screen size.  It seems like javascript is ignoring the "'width=screen.availWidth, height=screen.availHeight".  How can I make this open to all available height and width?
0
Comment
Question by:FrankTech
  • 2
2 Comments
 

Accepted Solution

by:
FrankTech earned 0 total points
ID: 22702721
Well, I figured it out. The code below works. Turns out the config parameters won't read screen.availWidth and screen.availHeight inside the single quotes, so have to put the parameters into a variable and call it like config = cfg.
function fullWindow() {
 
var wth = screen.availWidth;
var hgt = screen.availHeight;
hgt = hgt - 49;
 
var cfg = "width=" + wth + ",height=" + hgt + ",left=0,top=0,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizeable=no";
 
window.open('http://www.example.com', 'name', config=cfg)
}

Open in new window

0
 

Author Comment

by:FrankTech
ID: 22702733
Of course, the window identifier ('name' in the above code) does not have to be 'name', and  the hgt = hgt - 49 might need to be different on other monitors. On mine, subtracting 49 prevented the height from covering the Windows task bar.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question