Page is a not externally linkable
rocknbil - 2:18 pm on Oct 31, 2008 (gmt 0)
Another good one is "supplemental information" like small help files or supplemental content that would ordinarily clog up the topic with tangent data. What's annoying is when the navigation is to an ordinary page but the author seems to think a new window "keeps them on the site" more. Examples: A TOS or anything that moves from the prime objective: sell, sell, sell. In this case, it's always good to do: <a href="mypdf.pdf" target="_blank">View</a> (PDF 15K, new window) ... So they have some indication of what to expect. You can do JS in a strict doctype and it will validate. Just do it externally, attaching behaviors on load, and don't clog up the document with inline JS. <head> window.onload=function() { attachBehaviors(); } ... where attachBehaviors attaches .... behaviors .... to document elements by classname or id. In your document, these elements would of course have support for non-JS browsers. If present, the JS overrides natural behavior. Read up on "unobtrusive Javascript". I prefer JS methods over "target="_blank" for one reason. Target="_blank" will always open a new window or tab exactly the same size as the original, covering up the original and is extremely confusing or disorienting, especially if the user clicks and looks away for a slurp of coffee. With a Javascript method, you can control the size of the window so that's it's VERY obvious it's a new window and you can still see the parent behind it. As above, support for non-JS is mandatory (self-imposed.) This is an inline example, but in practice this would be externally loaded as mentioned: If JS is disabled, it uses blank.
While I agree "new windows" are overused, IMO there are good reasons for them. PDF is one of them, mostly because when it's first followed there's often a delay while the browser loads up the plugin and PDF. This is "something different" and outside the normal exploration of the rest of your pages. I'm thinking of moving to a strict doc-type, and I'm not really interested in using a JS workaround.
<script type="text/javascript" src="your.js"></script>
</head>
.....
<a href="mypdf.pdf" target="_blank" onClick="newWin('mypdf.pdf');>View</a> (PDF 15K, new window)
<script type="text/javascript">
function newWin(url) {
var day=new Date();
var id=day.getTime(); // Unique, assures new win. on every click
var win = open(url,id,600,500,'scrollbars,resizable');
}
</script>
Even with JS - consider the user and always allow these to be resizable and with scrollbars.