homepage Welcome to WebmasterWorld Guest from 54.211.213.10
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
HTML 4.01 strict and opening a new window
Triggered by XHTML thread
henry0




msg:580758
 3:09 pm on Apr 3, 2006 (gmt 0)

My XHTML pages validate fine
now after following the XHTML thread
I went to W3C and tried to validate the same page in 4.01 strict
Well it does not; a couple of things I can fix by adding to my CSS sheet.

But how do I fix that one?

Target "_blank"
That seems not to be in accordance with 4.01 strict.

 

kaled




msg:580759
 3:27 pm on Apr 3, 2006 (gmt 0)

If you want is to validate use transitional rather than strict.

I've seen people suggest the use of javascript to get around this - but that's just plain stupid.

Kaled.

henry0




msg:580760
 3:47 pm on Apr 3, 2006 (gmt 0)

Thanks that was where I was aiming, you comfirmed it.

iamlost




msg:580761
 6:46 pm on Apr 3, 2006 (gmt 0)

I have read complaints/concerns about the 'lack' of the target attribute since 'strict' was released along with 'frames' and 'transitional' in December of 1999. Why would 4.01 strict be expected to allow for a frames attribute? Why is it still a surprise?

Let the user decide with their browser whether to open a link in the existing window, in a new window, or in a tab. That the w3c decided to leave the choice to the user with 'strict' while allowing 'transitional' to pick up (mis)usage outside of the 'frames' DTD seems reasonable to me.

Also:
* Forced windows can be a confusing accessibility problem to some users.
* Forced windows can be an extremely irritating problem to many (most?) users.
* HTML is for marking up structure and semantics, CSS is for presentation, and scripting is for behaviour (i.e. new windows). I note that CSS3 looks to be stealing some behaviours - unfortunately, as I believe in the separation of powers.

Allan Rasmussen




msg:580762
 7:48 pm on Apr 3, 2006 (gmt 0)

I've seen people suggest the use of javascript to get around this - but that's just plain stupid.

No it's not, if you absolutely must open a link in a new window, it surely should be done with JS, as it's a behaviour. But ok, I think we do agree that doing so, in either way, is bad practice in most cases.

hlkgen




msg:580763
 8:24 pm on Apr 3, 2006 (gmt 0)

When someone uses javascript to cause a new window, and the user has disabled it, they wonder what has happened after they clicked a link...nothing happens. For accessibility, perhaps the user could be told that the document will open in a new window.

Fotiman




msg:580764
 8:32 pm on Apr 3, 2006 (gmt 0)


When someone uses javascript to cause a new window, and the user has disabled it, they wonder what has happened after they clicked a link...nothing happens. For accessibility, perhaps the user could be told that the document will open in a new window.

I think the suggestion here is that the link would still work if JavaScript was disabled. For example, something like this:

<a href="yourpage.htm" onclick="return openPage('yourpage.htm');">

Where the function openPage would return false and open a new window with the URL. Thus, if JavaScript was disabled, the link would open in the same window.

bedlam




msg:580765
 8:32 pm on Apr 3, 2006 (gmt 0)

When someone uses javascript to cause a new window, and the user has disabled it, they wonder what has happened after they clicked a link...nothing happens.

Not if the .js is implemented correctly. The basic strategy is to create the link normally and use javascript to change the link so that it will open in a new window when clicked. Users with javascript disabled get a normal link...

-b

kaled




msg:580766
 10:19 pm on Apr 3, 2006 (gmt 0)

Two thousand years ago, someone said "The Sabbath is made for man, not man for the Sabbath".

Standards are supposed to help webmasters not chain them up. Opening a link in another window is an entirely reasonable thing to do. I don't often make insulting comments about people who disagree with me, but I really do pity people who are so nazi-like in their opinions as to the separation of form and function in html design that they are unable to see that simplicity is a good thing.

Forcing webmasters to use javascript when it is not necessary is just plain stupid... period.

it surely should be done with JS, as it's a behaviour

Just exactly where does the action attribute of a form belong then? That is undeniably behaviour. Should that be consigned to javascript as well? Stupid, stupid, stupid.

Kaled.

piskie




msg:580767
 10:48 pm on Apr 3, 2006 (gmt 0)

I'm with Kaled on this one.
The oposing camp are influnced and prejudieced by unscrupulous webmasters that don't care which white hat practices they hijack and use to ambush visitors.

This is a mentality that has resulted in repeated Google updates that heavily penalise previously normal techniques when the undesirable sites utilise such techniques and practices that have been useful to many many "Good" sites for years.

If it gets abused, it must be bad practice.

How sad.

iamlost




msg:580768
 11:42 pm on Apr 3, 2006 (gmt 0)


Opening a link in another window is an entirely reasonable thing to do.

Yes it is. If you are using the 'transitional' or 'frames' DTD you may use the frames attribute 'target' to open a new window. If you are using the 'strict' DTD you may not use 'target' but may use client-side scripting including the 'onclick' js method mentioned.

Yes it is. But who should have final say of if/when it is reasonable, the user or the site? My personal preference is that final control (much like with CSS) should reside with the user. If you believe differently use the appropriate DocType/attributes to accomplish a standards validated design. Or simply ignore the validation error: compliance is strictly voluntary.

It is very simple: strict has never included 'target'. That people are now validating and 'discovering' this is amusing. That they are getting upset about it is baffling. It is not a change. It has been this way from the first release of 'strict' - over 6-years.


Just exactly where does the action attribute of a form belong then? That is undeniably behaviour.

'action' is the url containing the form processing agent (program) that will handle the submitted data. It is, in other words, a link. The entire form is a special (x)HTML creation enabling server-side data handling. I see little comparison to viewport manipulation or other client-side behaviour handling.


The oposing camp are influnced and prejudieced by unscrupulous webmasters that don't care which white hat practices they hijack and use to ambush visitors.

What does this have to do with 'target', 'strict', and HTML validation?

hlkgen




msg:580769
 2:49 am on Apr 4, 2006 (gmt 0)

<a href="yourpage.htm" onclick="return openPage('yourpage.htm');">

As simple as this and so many sites do it wrong. Shame.

pageoneresults




msg:580770
 3:01 am on Apr 4, 2006 (gmt 0)

Try this experiment.

Sit with someone who is not an everyday user of the Internet. Have them browse a few sites while you are with them. Take them to a site that has popups for external link references and even onsite links. Heck, I've hit sites before that implemented their code incorrectly and every link on the site had target="_blank".

Just picture a user who doesn't really understand the "new window" concept. They're surfing along while their Taskbar is filling up with open browsers and has exceeded 20. I know that may sound a little extreme, but I've seen it happen. And, it's happened numerous times.

I think the audience is more attuned to using their back button rather than closing open windows. Sure, new windows have their place and I usually reserve them for hi-res images, short legalities and such.

The JavaScript solution provided above is the suggested "best practice" method.

kaled




msg:580771
 9:47 am on Apr 4, 2006 (gmt 0)

As simple as this and so many sites do it wrong. Shame.

You're so right - it should be...
<a href="yourpage.htm" onclick="openPage('yourpage.htm'); return false;">

As written above, yourpage.htm would open both in the same window and a new window (assuming that openPage() returns true if successful).

Point of philosophy...

No one on planet Earth has the right to waste my time or the time time of other people. Forcing webmasters to use a complex solution because a simple solution is arbitrarily judged to be inelegant is an obscene abuse of power.

If html is permitted to hold content and structure only, css is permitted to hold presentational style only and javascript behavioural data, then, logically...
1) javascript control of style-sheets must be banned
2) css menus must be banned.

Of course, this is just ludicrous, but so is the removal of the target attribute from links and forms. And just as ridiculous is the fact that <noscript> is banned from the <head>... utterly insane.

Kaled.

Taffa




msg:580772
 11:02 am on Apr 4, 2006 (gmt 0)

<a href="yourpage.htm" onclick="openPage('yourpage.htm'); return false;">
This is not the best practise. The extra url is not needed, just use:
<a href="yourpage.htm" onclick="openPage(this); return false;">

and in your openPage function openPage(src)
to get url use src.getAttribute("href");

I'm not fan of inline event handlers, so I suggest you to Google unobtrusive javascript popup,
especially if you need to deal with large ammounts of popups.

Fotiman




msg:580773
 2:20 pm on Apr 4, 2006 (gmt 0)


<a href="yourpage.htm" onclick="openPage('yourpage.htm'); return false;">
This is not the best practise. The extra url is not needed, just use:
<a href="yourpage.htm" onclick="openPage(this); return false;">

No, that would open the CURRENT page, whereas the first method would allow you to open some other page.

For the record, I'm not a big fan of opening links in new windows, but I do think there are several valid reasons to do so. For example, in a web application "help" links might be opened in a new window.

DrDoc




msg:580774
 3:30 pm on Apr 4, 2006 (gmt 0)

Two things:

1) It would not open the current page. It would open the href referenced by the link
2) It is supposed to return false. If JavaScript is turned off, the regular href attribute will be honored and the link will open in the same window. With JavaScript turned off, the OpenPage() function will open the page in a new window, which is why
return false is needed to abort the normal behavior of the link, or else it would open twice for JavaScript users.

pageoneresults




msg:580775
 3:35 pm on Apr 4, 2006 (gmt 0)

Just picture a user who doesn't really understand the "new window" concept. They're surfing along while their Taskbar is filling up with open browsers and has exceeded 20.

Ever watch System Resources when you start opening multiple browsers? Especially IE? Too many open browsers and your system may come to a grinding halt. IE robs System Resources. When you close a browser, it never gives back all of the resources it took when it opened. Multiply that by the number of new windows being spawned and it creates usability issues for the user.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved