Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

controlling position of window

11:51 am on Apr 27, 2012 (gmt 0)

New User

joined:Apr 27, 2012
posts: 1
votes: 0

I am using Macromedia Dreamweaver 4.
I want to be able to write a link that will make a page open in a new window (presumably target=blank) and in a controlled size and position on the monitor.
I saw a piece of html that someone had given, consisting of a bit of Javascript that gave x and y values for the width and height and l and t values for the left top corner of the window. However, someone else cautioned that "Javascript is a no-non" because it forces users to turn off their pop-up blockers. I assume someone whose pop-up-blocker is on, or doesn't even know about it and about turning it off and on, would be frustrated by clicking and finding nothing happen.
What I am hoping for is that the main window will stay visible, at the left of the monitor, while the new window - or in some cases two new windows - can appear at the right, so that the user will be able to hop about between them by clicking.
3:58 pm on Apr 27, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

Welcome aboard Guy, the pop up warning is only partially true. Most browsers and AV softwares are kind of reasonable about it, they only block pop ups that are initiated without action from the user such as a body onload() handler. Most pop up windows initiated by links or form submits usually function just fine.

There are bigger reasons that most of them are a very bad idea, especially for those looking for copy and paste code or beginners. If implemented correctly, they're fine. I can explain those at length, but the bottom line is 1) there is often no consideration for alternate content if Javascript is disabled (and search engines can't read that content, hurting you in terms of SEO,) 2) no effort is made to assure a new window actually opens instead of opening the same content in an already open pop up, (which may be behind the main window, as described below,) and 3) designers often eliminate the scrollable and resizable parameters because they offend their design sense, and in doing so can eliminate vital content to some users - for example, with my browser settings, the window is too small and I can't get to a submit button or read the rest of the content.

I'll skip all those though because a pop up will never work for this:

while the new window - or in some cases two new windows - can appear at the right, so that the user will be able to hop about between them by clicking.

When the pop up opens and the user clicks into the main window, the focus is now on the main window and the pop up will be behind the main window and hidden. You won't be able to click back into the popup without moving or minimizing the main window. What you're really looking for here is modal content.

There are ways to do this without jQuery but jQuery has made it very easy. The content is already on the page, but it's hidden by CSS:

<p>Some visible content</p>
<div id="my-modal" style="display:none;">Some hidden content for the modal window</div>

Then on click of some div (or some other action) the hidden div is positioned absolutely and always "hovers" over the rest of the page content. Lightboxes are an example of this, and that might work, but they generally cover the whole page and demand all focus until they are closed. A search for Javascript modal (or Javascript lightbox) should lead you to one of the thousands of examples and scripts that can do what you're looking for.