Forum Moderators: open
Adding target=_blank to the href fixed the problem, but now the page doesn't validate for 4.01 strict. It comes up as an unallowed attribute.
---there is no attribute "TARGET" (explain...).
<a href="images/slide-show/default.htm" target=_blank>---
The owner couldn't care less, but I do. What are my options? And where should I go to learn a little more about targets or target substitutes?
Using things now, 'because they work', has on occasion been my downfall later. Once I let that bad habit slip through, it gets easier and easier to reach for it again and again.
[webmasterworld.com...]
The only valid approach with a strict doctype involves javascript in some fashion. Either that or not forcing the browser to open a new window. The target attribute is really part of a frameset DTD.
The W3C's handling of the target attribute in strict doctypes has been a source of more than a little controversy. But the rest of the DTD's dictates are well worth retaining even if you are reluctant to throw in javascript or dump the practice of opening a new window.
Looks like there isn't going to be the quick and correct fix that I had expected.
I can see why ---"The W3C's handling of the target attribute in strict doctypes has been a source of more than a little controversy.--- Seems like there is a gap to me. Why shouldn't it be fairly easy to open a new window and still validate for strict? It doesn't come up often for me because I generally don't like to open new windows, but sometimes it can be very helpful to do so.
If you're content to use JavaScript there is a quick and easy fix which validates in both HTML 4.01 strict and XHTML 1.0 strict.
Simply replace:
<a href="http://www.mysite.com/mylink.html" target="_blank">
Link Text
</a>
with
<a href="#" onclick="window.open('http://www.mysite.com/mylink.html'); return true">
Link Text
</a>
[without linebreaks]
Tried it out and it worked perfectly. My Javascript is really limited except for a small library of tricks, to which I will add this one.
The site is @50 pages and every one validates for HTML and CSS. I really didn't want to make an exception if I didn't have to. While I will make exceptions when necessary, pushing to meet standards has really raised the quality of my work.
Probably wouldn't have asked for the necessary script, but may now decide to upload this option.
There really should be some simple and 'approved' mark-up for this.
<a href="images/galleries/slide-show.html/" onclick="void(window.open(this.href, '', '')); return false;">BLAHBLAH</a>
I reference the file location but don't at all understand what is required for (this.href, ", ")?
"this" means the object that the JavaScript appears in, in this case the link, ".href" is the attribute of "this" that is being referenced, the first '' is the target if you want to re-use the new window, the second '' are any window features you want to specifically enable or disable.
Jordan