Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

js open window to fixed size

Posted on 2013-12-31
7
Medium Priority
?
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…

721 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