How do you set size when opening a new window?

J

JimO

When opening up a new window, is there a way to set it's size? Here is some
example code.

<table border="0" cellspacing="1" width="100%">

<tr>

<td width="20%" align="center"><font size="1" face="Comic Sans MS"><a
target="_blank" href="try_again.htm">Thomas Edison</a></font></td>

<td width="20%" align="center"><font face="Comic Sans MS" size="1"><a
target="_blank" href="try_again.htm">Alexande G. Bell</a></font></td>

<td width="20%" align="center"><font face="Comic Sans MS" size="1"><a
target="_blank" href="you_correct.htm">Lewis Latimer</a></font></td>

<td width="20%" align="center"><font face="Comic Sans MS" size="1"><a
target="_blank" href="try_again.htm">Andrew Carnegie</a></font></td>

<td width="20%" align="center"><font face="Comic Sans MS" size="1"><a
target="_blank" href="try_again.htm" height="10%" width="10">John D.
Rockefeller</a></font></td>

</tr>

</table>



Thanks,

Jim
 
J

Jukka K. Korpela

JimO said:
When opening up a new window, is there a way to set it's size?

Not in HTML. Otherwise, maybe. But...

We could tell you, but then we would have to killfile you.

Hint of the day:

"Opening up new browser windows is like a vacuum cleaner sales person who
starts a visit by emptying an ash tray on the customer's carpet. Don't
pollute my screen with any more windows, thanks (particularly since
current operating systems have miserable window management). If I want a
new window, I will open it myself!"

http://www.useit.com/alertbox/990530.html
 
R

Richard

Not in HTML. Otherwise, maybe. But...

There are many reasons for wanting to open a new window outside of popup
spam.
One good example is having the window for an enlarged view of an image.
Or perhaps for something in the way that gifworks.com uses their's.
 
R

Richard

JimO said:
When opening up a new window, is there a way to set it's size? Here is
some example code.

A new window is generally done using javascript, cgi, or even php.
Search the web for "window.open".
Enjoy the reading.
 
R

Rob McAninch

With JavaScript yes, but keep in mind that not everyone will use
JavaScript. So you may need to plan a plain HTML alternative.

Something here may help:
http://tech.irt.org/articles/script5.htm
A new window is generally done using javascript, cgi, or even
php. Search the web for "window.open".

New browser windows have nothing to do with Common Gateway
Interface, or the PHP Hypertext Preprocessor. That window.open is
JavaScript.
 
G

Galsaba

Here is the JavaScript code for this function. Let's say that when you click on
the words "see smal window" you will see the page call "mywindow.htm"

<a onClick = "MessageBoard()">see small window</a>

then, you have the function:

<Script Language = JavaScript>

function MessageBoard(dest,reg)
{
window.open("mywindow,htm","no","height=340,width=580")
}
</Script>

You may learn more if you post your message to the javascript group.

Aaron
 
N

nice.guy.nige

U

Ulujain

Richard said:
A new window is generally done using javascript, cgi, or even php.
Search the web for "window.open".
Enjoy the reading.

Show me how you'd open a sized popup window using PHP.

'Later
Peter
 
N

nice.guy.nige

While the city slept said:
Here is the JavaScript code for this function. Let's say that when
you click on the words "see smal window" you will see the page call
"mywindow.htm"

<a onClick = "MessageBoard()">see small window</a>

<a href="mywindow.htm" onclick="MessageBoard('mywindow.htm'); return
false;">see small window</a>

This will go some way to allowing your visitors to view the intended file
whether or not they have javascript available / activated.

Cheers,
Nige

--
Nigel Moss.

Email address is not valid. (e-mail address removed). Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
In the land of the blind, the one-eyed man is very, very busy!
 
A

Andrew Urquhart

nice.guy.nige said:
<a href="mywindow.htm" onclick="MessageBoard('mywindow.htm'); return
false;">see small window</a>

This will go some way to allowing your visitors to view the intended
file whether or not they have javascript available / activated.

Agreed [1]. An interesting problem occurs though with 3rd party pop-up
blockers that re-assign the window.open method (I think one of Norton's
products does this). The window.open is replaced with an empty object or
anonymous function that won't open a window. However, users with
javascript enabled select the hyperlink, follow the onclick and
reference the window.open object (which now does nothing) and then the
function exits, but the onclick event is then cancelled by the "return
false;". So users with javascript enabled, but with popular "Internet
Security" packages installed, get neither the original href nor the
pop-up window and I would imagine that only a tiny percentage of those
users know what has happened and how to work around it. Ultimately the
best advice must be "don't use window.open in a general WWW
environment".

[1] You can usually shorten the event handler to
onclick="MessageBoard(this.href)". There's also the possible requirement
for a keyboard event handler (but YMMV).
--
Andrew Urquhart
- FAQ: www.html-faq.com/
- Archive: www.google.com/groups?q=alt.html
- Contact: www.andrewu.co.uk/contact/
- Employ me: Front/middle tier ASP developer with WAI & web standards
 
T

Toby A Inkster

Ulujain said:
Show me how you'd open a sized popup window using PHP.

This chunk of HTML:

<a href="foobar.html"
onclick="window.open(this.href);return false;">Foobar</a>

Combined with the following HTTP header:

Content-Script-Type: application/x-httpd-php4

;-)

Technically, this tells the browser that any inline script is PHP to be
executed client side. Of course, most browsers will ignore it and execute
it as Javascript instead.
 
D

DU

Richard said:
A new window is generally done using javascript, cgi, or even php.
Search the web for "window.open".
Enjoy the reading.

The number 1 problem with your post is that a wide majority (say, 90%
and more) of copy-N-paste javascript sites with popup maker, popup
generator create invalid code which won't work on different browsers,
create incorrect code and/or with incorrect explanations, create bad
functions from an accessibility and usability perspective, maintains the
user dependent and ignorant on the best way to use popups, do not
educate users on the best way to use popup and how to code window.open()
properly, do not inform its users on how to make their popup code more
accessible and avoid problems on the user's side.

DU
 
G

Galsaba

Well, Jim -
I am curious to know, with the 15 answers that you got here, do you know now
what the answer is? If you do, please tell me what answer has the information
that you were looking for.
Thanks,
Jo
 
Joined
Nov 20, 2011
Messages
1
Reaction score
0
Quick Question:

Full disclosure, I am new to programming. I am looking for html script, or any script, that will allow me to build a website that automatically maximizes the browser's size when a visitor visits my page.

Ideal:
1. Visitor clicks on my page (with window size settings diminished)
2. Page loads, screen maximizes to the maximum size - proportionate to the monitor. Does not create a new page, expands within tab.


Much appreciated,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top