Jeremy Keith wrote:
Ted Drake wrote:
Jeremy Keith recently spoke about using the class in the link to
target a javascript to add the behavior, leaving a nice, clean link.
In the case of PDFs opening in a new window, you might not even need to
add a class. You could write a function that looks for the file
extension .pdf in the href attribute and open that link in a new
window. Something like this:
function preparePDFlinks() {
if (!document.getElementsByTagName);
var lnks = document.getElementsByTagName("a");
for (var i=0; i
One should consider using the native type attribute on the anchor
element as in:
TPS Report
this cause theoretical you could have a CGI/PHP/ASP/FooBar-script
generate the PDF for you.
TPS Report
On the main subject of this thread I am as many here seems to be not
really really sure what is best-practice. Do there exist a
'best-practice' for a thing like this? As someone pointed out already it
depends much upon the user base one have. I doubt the users of for
example computerubergeek.com would appreciate if you forced new windows.
On the other hand... A big shop whose main user group consist of
computer illiterates I agree that a new window approach is better as
many of these users expects this behaviour.
Can we make a silver bullet?
If you have members only site you could pretty easy implement user
settings like:
--- 8< -
Web application settings
Here you can control how the web application (this site, example.com)
should response to your actions when you interact (click on links etc.)
with it. Remember that these settings will only work if your browser
supports JavaScript and it´s activated.
[ ] Never ever (I mean it) open any[1] links in new windows (supercedes
all other settings).
[x] Open non web documents[2] in new window.
[x] Trust default beaviour on links.
... and so on...
--- 8< -
[1] We have a small disclaimer telling that we can´t effect external
links that come from a different domain and that are loaded inside an
iframe for example. The actual text is longer but you get it.
[2] The text 'non web documents' is a link navigating to a list that
lists(!) documents like Excel, Word, PDF etc.
Of course you could implement this even for a public site putting your
trust in cookies but you all know the impact on this.
I have recently been experimenting with a left-click context menu for
what I call 'advanced' links a.k.a. multi-choice-links (havn´t decided
what name feels best). What 'advanced' links is is left upon the
behaviour developer (JavaScript developer) to decide but the idea popped
to my head when it became clear that my standard way of defining links
to non web resources:
TPS Report class="Download">(type="application/pdf">download)
would become rather messy if I also added a 'open in new window'-link.
So now I have a new choice under 'Web application settings':
--- 8< -
[ ] Activate web application context menu on 'advanced' links[3].
--- 8< -
[3] Here again is a link leading to 'our' definition of 'advanced' links.
Conclusion is that your wab application should grow as your users grow.
Newbies to the internet and/or your site should feel comfortable and the
web app should adhere to the 'least surprise respond'-philosophy. It
should also be able to live up to the challenges that the more advanced
users set out.
Well, this is only my ideas on the subject =)
Live long and prosperous
/Anders
**
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
**