Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

JS maximize window script fails

Posted on 2004-09-15
9
Medium Priority
?
318 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

597 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