Log in

View Full Version : Specify target window size without Javascript?



Eternal_Howl
07-27-2007, 09:21 AM
I'm want to have a link on my page, that when clicked on, opens up a new window, but I want to specify the size of that window - is there a way to do that without javascript?

Traditionally, target="blank" or target="new" etc will open up another window but can you specify the size of that window?

Veronica
07-27-2007, 08:59 PM
Javascript will open up the window in a specific height and width, plus with or without scrollbars, etc. You can combine the javascript call with a noscript tag that calls for the window to just open with a target. That way, if someone has javascript turned off, they can still access the content.

<a href="#" onClick="window.open('yourpage.htm','pagename','resizable,height=260,width=370'); return false;">New Page</a><noscript>You need Javascript to use the previous link or use <a href="yourpage.htm" target="_blank">New Page</a></noscript>

Twey
07-27-2007, 09:07 PM
To answer your question, no, there isn't. Support for the target attribute has also been dropped in modern standards; you're advised to avoid popups at all. If it's more convenient to open a certain link in a new window or tab, it's up to the user to open it as the user prefers and resize it to dimensions that make sense on his/her system, taking into account things like font size, visual acuity, and screen resolution.

Sliight
07-27-2007, 11:52 PM
I know this is silly, and I don't think it is javascript, but is this line of code javascript?: <p><a href="/dispute_print.html" onclick="NewWindow(this.href,'name','600','800','yes');return false">Click here for a printable dispute form for mailing.</a><br><br>

The reason I ask is because that code gives me a pop up window sized how I want in IE7, Opera, Safari, and FF

Eternal_Howl
07-28-2007, 05:28 AM
Thanks guys for all your replies.


To answer your question, no, there isn't. Support for the target attribute has also been dropped in modern standards; you're advised to avoid popups at all. If it's more convenient to open a certain link in a new window or tab, it's up to the user to open it as the user prefers and resize it to dimensions that make sense on his/her system, taking into account things like font size, visual acuity, and screen resolution.

Thanks. It wouldn't have been a forced pop-up, but rather an option if someone required it because they can't run script.