Forum Moderators: open

Message Too Old, No Replies

Defining size of target=_new

can you even do this?

         

juniperwasting

9:22 pm on May 2, 2003 (gmt 0)

10+ Year Member



In an attempt to keep important popUp information on my site from being blocked by popUp blockers, I am trying to use target=_new in HTML href's. I want to define the size of the window I am opening, and all the other fine parameters a good popUp could give me. Does anyone know if I can just simply define them with a simple width=*n* and height=*n* toolbar=0 etc.?

J

deejay

9:57 pm on May 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not that up with this stuff, but this is the code I use for links to open in a new set size window... lets you specify size

<a href="" target="closeup" onClick="closeup = window.open('1030e.html', 'closeup', 'scrollbars=yes,resizable=yes,screenX=0,screenY=0,width=416,height=450'); return false;">click</a>

tedster

11:06 pm on May 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You cannot define the size of a new page using the target attribute - that's up to the browser itself. Javascript is the recourse here, and of course, you can combine a regular link with an onClick function to catch 90% with the javascript approach and give the rest of your visitors a regular new page.

<a href="page.html target="_blank" onClick="javascript:popUpFunction('page.html');return false;">

While we're on the topic, target="_new" is not one of the "reserved" target names. And for HTML to validate, all other (non-reserved) target names should begin with an alphabetic character. Here are the four reserved cases:

The following target names are reserved and have special meanings.

_blank
The user agent should load the designated document in a new, unnamed window.

_self
The user agent should load the document in the same frame as the element that refers to this target.

_parent
The user agent should load the document into the immediate FRAMESET parent of the current frame. This value is equivalent to _self if the current frame has no parent.

_top
The user agent should load the document into the full, original window (thus canceling all other frames). This value is equivalent to _self if the current frame has no parent.

W3C Reference [w3.org]

ShawnR

11:49 pm on May 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



juniperwasting doesn't want to use onclick() because of pop-up blockers. What you do is use your normal <a href= target="_blank" > construct. Then set the width & height in the 'onload()' method of the new window rather than the calling window. Something like

window.outerHeight = ( window.screen.availHeight / 2 );

Shawn

juniperwasting

2:36 pm on May 5, 2003 (gmt 0)

10+ Year Member



Thanks for the tips folks, I think i will have to try the

"Then set the width & height in the 'onload()' method of the new window rather than the calling window"

method to get the results I am looking for.

j