Solved

JS maximize window script fails

Posted on 2004-09-15
9
302 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 23

Assisted Solution

by:adilkhan
adilkhan 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now