Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

js open window to fixed size

Posted on 2013-12-31
7
Medium Priority
?
325 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 332 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 332 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 336 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
Suggested Courses

926 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