Avatar of KnowledgeWare
KnowledgeWare
 asked on

js open window to fixed size

This is likely easy but escapes me. I have an index.htm page that I want to open to a set size with toolbars turned off, etc. I can do this from a second htm page (start.htm) with the code below in in which opens index.htm to a set size, but I cannot find a way to put this code into index.htm and just have it open to the correct size without being called from start.htm How can I put this code into index.htm and just have it open with the preferences below?

Thanks


<script>
function openWin()
{
window.open("index.htm","_blank","toolbar=no, scrollbars=no, resizable=no, top=50, left=50, width=975, height=732");
}
</script>
</head>

<body onload="openWin()">
JavaScript

Avatar of undefined
Last Comment
KnowledgeWare

8/22/2022 - Mon
SOLUTION
Amar Bardoliwala

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Tom Beck

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
KnowledgeWare

ASKER
Thanks all for comments, but I'm not a web programmer (obviously) and still confused. Is it not possible to open the index.htm page at size 975 by 732 and turn off the toolbars, etc? I don't understand why that is not possible, it seems trivial.

tommyBoy you mentioned I could have the main page spawn a modal popup and put my content in that. Isn't that more or less what I'm doing now - the index.htm calls the start.htm page which sets the size and turns off toolbars. This seems to work fine, but I'm not sure if popup blockers will prevent this from running.

Don't take this the wrong way... but after decades of web programming it seems bizarre that I cannot (easily) open a page at a specific size.

Thanks
Ron
ASKER CERTIFIED SOLUTION
Rainer Jeschor

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
KnowledgeWare

ASKER
Thanks Rainer.... I'll check your link out as soon as I can.

BTW folks...forgive my bitchy attitude at times...I appreciate all your comments...but I get frustrated with this stuff that I'm not good at!

Ron :- )
KnowledgeWare

ASKER
Hello Rainer:

Thanks, I don't understand much of the code in the link you sent, but I think this is the critical element I need:    self.close()

When I insert that however I get an alert message to the user confirming that they want the window closed. Is there a way around that? That's going to be awkward.

Also - this is off topic but related - is there a way to 'pause' the script for 5 seconds to allow the other window to open? What's happening now is the self.close() brings up the alert before the secondary window has opened.

Ron
Your help has saved me hundreds of hours of internet surfing.
fblack61
KnowledgeWare

ASKER
Thanks to all!