Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 328
  • Last Modified:

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()">
0
KnowledgeWare
Asked:
KnowledgeWare
3 Solutions
 
Amar BardoliwalaCommented:
Hello KnowledgeWare,

This kind of settings can be applied to page which you want to open as  popup window.

Also as far as I know, you can not open your index page or first page of site as popup window.

You can do that only from some other page of site or from page of other website.

Hope this will help you.

Thank you.

Amar Bardoliwala
0
 
Tom BeckCommented:
...not to mention that browsers often have the popup blocker turned on.

You could have the main page spawn a modal popup and place your content in that. The main page could be blank or have a message on it. That would avoid popup blockers. Unfortunately, if the user's browser window is smaller than 975 x 732 then the modal window overflow will be cut off.

End user's have complete control of their browser window size and how much screen real estate it takes up. They can block popups. That's the "P" in "PC" (personal). The day a web page can dictate how much space it takes up on your screen on load will be a bad day for web development.
0
 
KnowledgeWareAuthor Commented:
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
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Rainer JeschorCommented:
Hi,
due to security reasons you cannot modify the toolbar display through Javascript.

Workaround:
You open another popup window and close the parent like this EE solution:
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_20782379.html

This is likely your existing solution with the add-on to close the parent.

Still the other experts comments are valid: it depends a lot on the clients browser and their configuration.

HTH
Rainer
0
 
KnowledgeWareAuthor Commented:
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 :- )
0
 
KnowledgeWareAuthor Commented:
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
0
 
KnowledgeWareAuthor Commented:
Thanks to all!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now