Page 1 of 1
open an link in a new (_blank) window in XHTML 1.1
Posted: Fri Aug 13, 2004 7:31 am
by vigge89
I decided to code my new site in XHTML 1.1, but i've come to an problem;
XHTML 1.1 doesn't allow the target="" attribute in anchors (<a></a>).
I want to load a link in a new window, but how can i do this if targets are disabled? is there some else attribute which does this? using javascript is maybe possible, but it's too simple too use JS
Thanks in advance.
Posted: Fri Aug 13, 2004 8:42 am
by Draco_03
to open a windows in javascript it's simply
Code: Select all
function openren() {
window.open("path_to_the_file.php", "", "width=500,height=500,toolbars=no,menubar=no,statusbar=no,resizable=no,scrollbars=no,history=no");
}
If you want everything (menu bar history adress bar scrollbar, well just put yes)
Posted: Fri Aug 13, 2004 8:44 am
by vigge89
yeah, i know that can be done, but I wondered how you are supposed to open new windows with, when target is disabled, there's gotta be some way else then using javascript, or have w3 gone mad?

Posted: Fri Aug 13, 2004 12:33 pm
by zenabi
This page will help you:
http://www.sitepoint.com/article/standa ... iant-world
Unfortunately it does require some JavaScript and I came across a problem with it not working in older browsers.
Posted: Fri Aug 13, 2004 2:09 pm
by Draco_03
Err didn't know that , interesting.
But, write ALL THAT to get a _blank applied, when you could simply just put a small js script.
...
Posted: Fri Aug 13, 2004 2:24 pm
by feyd
that doesn't look like much to have written in...
Posted: Fri Aug 13, 2004 2:27 pm
by vigge89
nope, it's a good solution, hopefully it'll work for most browsers

i came to a problem when changing the DOCTYPE too XHTML 1.1, my menu got misplaced somehow (after changing back to XHTML 1.0, it worked again

), so i'll probably keep the XHTML 1.0 doctype, therefore, i wont need this right now.
thanks for the answers everyone

Posted: Fri Aug 13, 2004 2:30 pm
by Draco_03
feyd wrote:that doesn't look like much to have written in...
Agreed but. err it's still more stuff to write.
And I just didn't see the reason not to use a window.open
Anyways that was just my opinion glad you got the answer you were looking for
