Solved

JS maximize window script fails

Posted on 2004-09-15
9
311 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

730 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