Solved

JS maximize window script fails

Posted on 2004-09-15
9
310 Views
Last Modified: 2008-02-01
Hi Experts

Here is my JS window maximization script:

top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight < screen.availHeight||top.window.outerWidth < screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}

Now, does anyone know of any conditions under which this script would not work? I myself have had IE 5+ report some kind of "property is read-only" error when trying to run this script. I have never been able to figure out the conditions under which the problem occurs.

Thanks.
0
Comment
Question by:metalaureate
9 Comments
 
LVL 5

Accepted Solution

by:
darksinclair earned 250 total points
ID: 12071163
Why all the complication?  Are you saying that this does not work at all?  cause I do believe I've seen this solution (the exact code you posted) on this website somewhere ... infact I know someone has already made this code and it worked for them...

Try this script instead if you rhaving problems... Pretty simple and I've had no problems with it, :

window.moveTo(0,0);
window.resizeTo(window.screen.availWidth,window.screen.availHeight);

Cheers,
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 12071167
have you tryied this?

<script language="JavaScript">

window.moveTo(0,0);
window.resizeTo(screen.width,screen.height);

</script>
0
 

Author Comment

by:metalaureate
ID: 12071204
I'm sorry, I wasn't clear: the code works very well. I want to know if there are any conditions under which it would *not* work, such as IE security settings. I myself have encountered something I thought might be a case of it not working, but am unable to reproduce the problem.

Whatever problem script would have, you would have it to, so perhaps the question just relates to the use of resizeTo.

Any problems with using resizeTo? (they would be quite obscure, if there were)

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 23

Assisted Solution

by:Saqib Khan
Saqib Khan earned 250 total points
ID: 12071791
> such as IE security settings.

if the Active Scripting is disabled in IE  then none of your jScript Code will Run.
resizeTo works fine on IE and NS

Good Luck
0
 
LVL 5

Expert Comment

by:darksinclair
ID: 12079849
metalaureate : im affraid I can't answer the question of "will it always work", however, I do fear that you use some commands that are IE only (outerWidth being one I believe. I may be wrong...)  If you need a totally accepted solution then the one I posted would be your best bet as I know it works on all platofrms I've seen (NS, IE, Mac IE, firefox, etc.)

Cheers,
0
 
LVL 3

Expert Comment

by:hemebond
ID: 12149248
Stop trying to control the users browser, it only annoys people. And I'll tell you when it'll fail, when I look at it, because I have rubbish like this blocked.
0
 

Author Comment

by:metalaureate
ID: 12150287
The context for my question is a secondary window that the user requests, which for various technical reasons needs to open as large as possible. You couldn't block this, as it is not in the class of nefarious activity you refer to, of which I also disapprove.

Please don't post insulting uninstructive comments based on poor reasoning about data you don't have.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Select case on click 3 19
Multiflying 2 Input Text On a Table 7 31
I was able to prove the index of the even , how can i get the even index? 4 28
html Uncheck Checkbox 2 25
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

809 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