Solved

js open window to fixed size

Posted on 2013-12-31
7
312 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
Comment Utility
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
Comment Utility
...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
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 84 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks to all!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now