/    Sign up×
Community /Pin to ProfileBookmark

Help someone less smart than you! -Window Absolute positioning

Don’t ask why, I know its horrible but my boss wants a window that opens full screen. Ok, no problem. Next he wants said maximized window to adjust its absolute position depending on where your windows toolbar is (you see, he puts it vertical along the left of the screen and the browser window opens using the correct available space but positions it at (0,0) hense, overlapping with the toolbar). Below is the code I’m using.
Thanks for your help,
Mike

<script language=”JavaScript1.2″>
<!–

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;
}
}
//–>
</script>

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@VladdyJun 16.2004 — Thank god this wont work in real browsers :rolleyes:

Find a better boss
Copy linkTweet thisAlerts:
@mcemondauthorJun 16.2004 — I can't ? he's sort of a future father in law.
Copy linkTweet thisAlerts:
@PittimannJun 16.2004 — Hi!

This code snippet is assuming (like me :p), that your future wife and thus your future father in law are worth it:[code=php]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
var barWidth=35;
window.resizeTo(600,450);
function putWin(){
window.moveTo(barWidth,0);
if (document.all) {
window.resizeTo(screen.availWidth-barWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (window.outerHeight < screen.availHeight||window.outerWidth < screen.availWidth){
window.outerHeight = screen.availHeight;
window.outerWidth = screen.availWidth-barWidth;
}
}
}
//-->
</script>
</head>
<body onload="putWin()">
</body>
</html>[/code]
Just play with the value of var barWidth to adjust it properly.

Cheers - Pit
Copy linkTweet thisAlerts:
@mcemondauthorJun 16.2004 — Thanks Pit, I'll try it out.
Copy linkTweet thisAlerts:
@PittimannJun 16.2004 — Hi!

You're welcome!

I really wonder, what that shall be good for. Clicking the taskbar would make the window lose focus and avoiding that with a script would be annoying...

Cheers - Pit
×

Success!

Help @mcemond spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...