Forum Moderators: open

Message Too Old, No Replies

window open

changing the size and position without saving

         

Ozyris

10:36 pm on Nov 13, 2004 (gmt 0)

10+ Year Member



Hey Guys,

This is my first post here, so.. please, be gentle, :)
This is the situation, my web site [eyedeasolutions.com...] opens too many windows, i wanted to make the user to see in one fized size and this was the most easyer solution, yet, I've seen some code that allowed to restore the user defaults (befores the visit to my web page) when the window was closed.

I want to change the size and position in the onLoad event and now in a OnClick, and this changes every openning after the user close my window. I've had this working but somehow, I've deleted the code and can't make it anymore..

So If someone can help me..

Thanx
Ozz..

adni18

11:38 pm on Nov 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<script language=javascript>
window.moveTo(20,20);
window.resizeTo(500,700);
</script>

Ozyris

11:26 am on Nov 14, 2004 (gmt 0)

10+ Year Member



thank you for your reply, adni18.

with that code i can change the position and size, but, what I want to do is:

after centering on screen with a certain size, wich I already can make, I want that after the user closes the window, his defaults for size and position are reseted. I don't want to change the defaults of the USER to his browser size and position.

Best Regards,
Ozz...

adni18

1:49 pm on Nov 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try this in the main html file:


<script language=javascript>
var usrWidth;
var usrHeight;
var usrLeft;
var usrTop;
function openWin() {
if(usrWidth==null){
window.open('page.html','page','left=300,top=400,width=500,height=500')
}
else
{
window.open('page.html','page','left='+usrLeft+',top='+usrTop+',width='+usrWidth+',height='+usrHeight)
}
}
function changeVars(ship) {
usrWidth=ship.clientWidth;
usrHeight=ship.clientHeight;
usrTop=ship.clientTop;
usrLeft=ship.clientLeft;
}
</script>

and for page.html:


<body onUnload="window.opener.changeVars(window)">

Ozyris

2:20 pm on Nov 14, 2004 (gmt 0)

10+ Year Member



thank you again, the code I'm using is the folowing:

function maximizeWin() {
if (window.screen) {
var aw = screen.availWidth;
var ah = screen.availHeight;
if (aw > 800) window.moveTo((screen.width)? (screen.width-790)/2 : 0, (screen.height)? (screen.height-680)/2 : 0);
else window.moveTo(0, 0);
// window.resizeTo(aw, ah);
window.resizeTo(775, 560);
}
}

<body onLoad="maximizeWin()">

sorry, but i couldn't undestand your code, I'm not using a new window, when I open a window, that's the window I change. the userVars, I already tought about it but could't make it work, try to paste the function maximizeWi() in a blank html file and use the onLoad, then, when you close the window, you'll notice that every window you open after will have that size and position, that's not what i want.

Thanx again
Ozz