?
Solved

JS maximize window script fails

Posted on 2004-09-15
9
Medium Priority
?
316 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 5

Accepted Solution

by:
darksinclair earned 1000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 23

Assisted Solution

by:Saqib Khan
Saqib Khan earned 1000 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

771 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