homepage Welcome to WebmasterWorld Guest from 54.234.74.85
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
controlling position of window
Guy Ottewell




msg:4446490
 11:51 am on Apr 27, 2012 (gmt 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.

 

rocknbil




msg:4446575
 3:58 pm on Apr 27, 2012 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved