I want a link to open a new window to show an image but when I use target='blank' I lose my compliance with 'strict' doc type validation. How can I do this and still validate?
Cheers
Harlequeen
Does this help:
Does this help: http://www.alistapart.com/articles/popuplinks/
My personal suggestion would be to not force windows to pop open for your users. If they want to open a new window let them decide to ctrl-click or right click -> open in new window.
I've never had a problem
I've never had a problem with target="_blank", maybe it's because the syntax isn't right and you need the underscore before the word blank.
I've noticed most people [or at least a lot of people] don't know to right click links and open in a new tab or window. One of the people I work with even clicks links twice, no matter how many times I tell her not to.
Sometimes you just have to accommodate ignorance/stupidity... whatever you prefer to call it
It is not a matter of being
It is not a matter of being accommodating, the point and issue is missed; it's a question of trying to impose your wishes on the end user, we the developer should not assume the right and user ignorance isn't an excuse (they must learn to use the tools at their disposal, or accept reduced enjoyment ). A browser has a set of controls for a purpose if the developer tries to overide these controls, provided so that the user may choose prefered behavior, they are acting outside of their remit. Avoid new windows as much as possible, if you really have to use them then write them to the DOM via scripted behaviour.
stinkysGTI wrote:I've never
I've never had a problem with target="_blank", maybe it's because the syntax isn't right and you need the underscore before the word blank.
The attribute "target" doesn't exist in strict. Its value is irrelevant. Validation should fail with an "unknown attribute" error.
Clients sometimes desperately want a new window for links on their website. I cheat and use a javascript to add a target attribute (recognised by all browsers although strictly not part of the DOM for a strict document) to links identified by another attribute (e.g. class="new" or rel="external"). The purist method is to do something similar but not by adding a target attribute but by attaching an onclick handler that calls a window.new(). Unfortunately, security settings may prevent that working.
I find several of your
I find several of your comments interesting but puzzling.
On the one hand you maintain that the developer/designer should not impose their own wishes or preferences on the user. But don't we do exactly that constantly with the UI, design and functionality decisions we make about how a page or feature should function or look?
You imply a respect for the user which is contradicted when you say that we should not take into account user ignorance or expectations.
The majority of users have not a clue about right click or that they can use that to open a link in other window. And it's an even smaller percentage who ever click on their browser preferences or even know that it's there or why they should care. IMHO a developer should design with such user behaivour and limitations in mind.
It seems to fly in the face of your alleged respect for the user to say that you can ignore user ignorance as a developer.
Also the set of controls is not consistent among browsers.
My comments are not directed at the specific issue of opening new windows, though i agree that a proliferation of new windows is a bad idea.
Quote:But don't we do
But don't we do exactly that constantly with the UI, design and functionality decisions we make about how a page or feature should function or look?
Developers should be aware that all of that can be overridden by the user (if they so wish/are knowledgeable enough).
We do need to be aware of user ignorance-- mostly when they are sending us information or interacting with something (a form or widget). If they can't figure out how to use it, they leave.
We also do need to be aware of user expectations, as you said. It doesn't mean we can't break them-- having links that aren't underlined for example. But when we do so we should be aware of the risk.
By setting styles AT ALL we impose something on the user. But the user can turn styles off, can be using a strange non-standard UA, might not have Java-junk enabled or fully enabled, can impose their own stylesheets, font sizes, colours/contrast, whatever. It might make our pages ugly, but it had better still be usable and readable. It had better still work.
A new window can go against some expectations (they were popular enough last decade that they may in fact be the expectation too!) but that alone wouldn't be a good enough reason not to do it. The reason not to do it is it breaks the back button, basic browser functionality. Everyone seems to know how to use it, and we use it even when there's text on a page warning us not to use it, or a Javascript button on the page that says BACK in big letters. It's like one of the most important and most-used buttons. If you are making new windows on someone who has full-sized browsers (like I do) users, despite experiencing 10 or 15 years of new windows, get confusled. Sometimes they get ready to shut down the computer and find a bunch of browser windows still open, thinking they'd closed them. Since not everyone has a browser that can override target and open new tabs (not every browser has tabs) it's something we can impose on the user and some of them can't do Anything about it. And that's where it kinda sucks.
I've used target=blank, when I could find no decent way around it. I dropped down to a transitional doctype. It's more honest I think.
Though at least if you do it with Javascript, I can keep that disabled and not have any new windows foisted on me.