homepage Welcome to WebmasterWorld Guest from 23.22.179.210
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Define window size in target=" blank"?
dimmy




msg:3429897
 10:54 am on Aug 23, 2007 (gmt 0)

In HTML I want to link to a new page with specific limited information (a table or a graph) without losing contact with the active page. This could happen by opening a new window with limited size.

I suppose that the target="_blank" tag in the <a href ...> command is the solution

I wonder whether it is possible to dynamically define the size of the window opened through the <a href="#*$!.htm" target="_blank"> command

Dimmy

 

penders




msg:3430184
 2:32 pm on Aug 23, 2007 (gmt 0)

You can't define the size of the popup window in HTML alone, you need to use a little JavaScript. Bear in mind, however, that browsers can be configured to ignore such resize requests. And also make sure you're 'popup' is still accessible to those without JavaScript.

You could have a gander at this thread:
[webmasterworld.com...]

Benco




msg:3430189
 2:38 pm on Aug 23, 2007 (gmt 0)

To my knowledge you cant do that with HTML alone, but a little bit of javascript will help:


<script type="text/javascript">
function showPopup(url) {
newwindow=window.open(url,'name','height=190,width=520,top=200,left=300,resizable');
if (window.focus) {newwindow.focus()}
}
</script>

Then you code your link like that:


<a href='...' onClick='showPopup(this.href);return(false);'>Info</a>

When javascript is disabled, the link still works the normal way.

[edited by: Benco at 2:42 pm (utc) on Aug. 23, 2007]

dimmy




msg:3436522
 12:59 pm on Aug 30, 2007 (gmt 0)

Thank you for the valuable information

In fact looking at [webmasterworld.com...] it seems that it is not a good idea to use pop-ups when text is involved considering that the page viewer might use different font size or it might not work well in Firefox.

In that sense I suppose it shouldn't be a problem if I used pop-ups for diagrams.

I run a political research lab where the results of polls appear in tables and I need to present also a graphical representation of the table (in an image file).

Then the popup only presents a title for the diagram plus the image file.

Is there any possibility for different appearance according to the browser specifications of page viewers?

Thank you

Dimmy

penders




msg:3437113
 11:11 pm on Aug 30, 2007 (gmt 0)

...it seems that it is not a good idea to use pop-ups when text is involved considering that the page viewer might use different font size or it might not work well in Firefox.

As long as the popup window is resizable and/or scrollbars are available to access any out-of-sight content, then there shouldn't be a problem in using text in a popup. I have not come across a problem with FF in this respect?

Is there any possibility for different appearance according to the browser specifications of page viewers?

Yes, different browsers are likely to render the popup slightly differently. And this can depend on how a user has their machine setup too.

There are other 'parameters' that can be used in the 'features' argument of the window.open() method (above). Such as location=0, menubar=0, status=0 (and more) to turn off the address bar, menu bar and status bar respectively etc. But some of these are browser specific and there is no guarantee that they will work with modern browser security. If you are relying on there being no address bar, menu bar or status bar and they show-up, then you will have less room for your content and your window will need to be bigger.

Also, with tabbed browsers, it is quite possible that your popup won't 'popup' at all, but instead open in a new tab.

IMO the only valid use of a popup is if it is most desirable to keep the user on the current page whilst displaying more relevant (but optional) information. In which case, if a new tab was opened it shouldn't matter.

Benco's method would certainly be the way to go for an accessible popup.

The other option would be to not use a popup-window at all, but have a hidden DIV (position:absolute) with your 'popup' content which you make visible instead in the onclick event. Although the effect can look like a popup window, all the content is on the same page and you have greater control of its position and look.

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