Solved

js open window to fixed size

Posted on 2013-12-31
7
315 Views
Last Modified: 2014-01-03
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
Comment
Question by:KnowledgeWare
7 Comments
 
LVL 11

Assisted Solution

by:Amar Bardoliwala
Amar Bardoliwala earned 83 total points
ID: 39749685
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
 
LVL 38

Assisted Solution

by:Tom Beck
Tom Beck earned 83 total points
ID: 39749810
...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
 

Author Comment

by:KnowledgeWare
ID: 39750162
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 84 total points
ID: 39750183
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
 

Author Comment

by:KnowledgeWare
ID: 39750219
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
 

Author Comment

by:KnowledgeWare
ID: 39750308
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
 

Author Closing Comment

by:KnowledgeWare
ID: 39755268
Thanks to all!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

777 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