/    Sign up×
Community /Pin to ProfileBookmark

target="_blank" – oops (from transitional to strict)

I knew there was one error I had while changing from transitional to strict that I’d forgotten; it was this: “target is not an attribute.”

My original (transitional) page had this (double-spacing in
an effort to prevent horizontal scrolling):

[code]
<p>You can find my nonsensical<a href=”collapse.htm”

target=”_blank”>&nbsp;Collapsing&nbsp;Boxes&nbsp;</a>

on a page that will open a new browser window.</p>
[/code]

In order to validate the page as strict HTML, I removed the

target=”_blank”

And the file validated as strict.

I did sort of wonder about that usage. In this particular situation, since the target is on my same site, I don’t think it matters a lot. But on a couple of pages, I link to other sites, and use the same instruction.

Is that something very different, and might that validate, when this version, linking to the same site, doesn’t? (in strict HTML 4.01).

Can anyone perceive what I’m not understanding? <haha!>

Is there some other way I can or should handle this?

Thanks!

Sat, 29 Jan 2005 23:04:51

to post a comment
HTML

24 Comments(s)

Copy linkTweet thisAlerts:
@CharlesJan 30.2005 — [font=monospace]<p>You can find my nonsensical <a href="collapse.htm" oncick="window.open (this.href, 'child'); return false">Collapsing Boxes</a>

on a page that will open a new browser window.</p>[/font]

And please note, Browsers are expected to normalize white space by removing it at the beginning and the end of an element. Be sure to use: [font=monospace]<p>Hello, <em>World!</em>[/font] in place of [font=monospace]<p>Hello,<em> World!</em>[/font].
Copy linkTweet thisAlerts:
@CarolWauthorJan 30.2005 — [i]Originally posted by Charles [/i]

[B][font=monospace]<p>You can find my nonsensical <a href="collapse.htm" oncick="window.open (this.href, 'child'); return false">Collapsing Boxes</a>



on a page that will open a new browser window.</p>[/font]



And please note, Browsers are expected to normalize white space by removing it at the beginning and the end of an element. Be sure to use: [font=monospace]<p>Hello, <em>World!</em>[/font] in place of [font=monospace]<p>Hello,<em> World!</em>[/font]. [/B]
[/QUOTE]


Thanks, Charles. I had "&nbsp;" in the code, but I guess it didn't show, and perhaps my quote here, just in quotes, also won't show - I need to "escape" it? Is that what "escape" means? If so, I'm not sure how to do that. Anyway, I used the character entity (oh, my; I'm learning the jargon) for a non-break-space - ampersand, nbsp, semicolon. So I think I dind't have white spaces in there, but I'm not sure, exactly. And I'll keep in mind what you said about that!

(You probably understand what I mean better than I do! <g>

I also need to learn the meaning of "em"- I think it has two meanings. I could probably find it on W3C (again; I'm learning!)

P.S. I see a pair of empty quotes with apparent white space when I preview my reply, so my guess was correct - wow - I am learning something!

Sun, 30 Jan 2005 07:31:56
Copy linkTweet thisAlerts:
@CarolWauthorJan 30.2005 — [i]Originally posted by Charles [/i]

[B][font=monospace]<p>You can find my nonsensical <a href="collapse.htm" oncick="window.open (this.href, 'child'); return false">Collapsing Boxes</a>



on a page that will open a new browser window.</p>[/font]



And please note, Browsers are expected to normalize white space by removing it at the beginning and the end of an element. Be sure to use: [font=monospace]<p>Hello, <em>World!</em>[/font] in place of [font=monospace]<p>Hello,<em> World!</em>[/font]. [/B]
[/QUOTE]


Now I'm beginning actually to work on this, and realize there are things here I don't quite understand.

1) Is that Javascript - that "onclick" directive? IF so, waht do I put in the <head> area of my document to allow it?

Seems to me I read somewhere that there are a few commands of just this sort that don't require Javascript, and perhaps "onclick" is one of them. (Says me, hoping, but doubtful.)

That "this href" isn't exactly what's needed there, is it? Does it stand for something more specific? Or maybe I could find out at W3C org - if so, where should I look for the information?

Thanks!

Sun, 30 Jan 2005 09:15:21
Copy linkTweet thisAlerts:
@phpnoviceJan 30.2005 — [i]Originally posted by CarolW [/i]

[B]In order to validate the page as strict HTML, I removed the



target="_blank"



And the file validated as strict.[/B]
[/QUOTE]

I don't know why the PTB decided to remove [B]target[/B] from HTML 4.01. To my understanding, they did not even include it in the Frameset DTD -- where [B]target[/B] is most useful/needed. Also to my understanding, you will only find [B]target[/B] in the Transitional DTD. ?
Copy linkTweet thisAlerts:
@phpnoviceJan 30.2005 — [i]Originally posted by Charles [/i]

[B][font=monospace]<p>You can find my nonsensical <a href="collapse.htm" oncick="window.open (this.href, 'child'); return false">Collapsing Boxes</a>



on a page that will open a new browser window.</p>[/font][/B]
[/QUOTE]

I guess Charles doesn't mind suggesting code to you that [u][i]won't open[/u] in a [u]new[/u] window[/i] for 10%-12% of the potential visitors to your site.
Copy linkTweet thisAlerts:
@CharlesJan 30.2005 — [i]Originally posted by phpnovice [/i]

[B]I guess Charles doesn't mind suggesting code to you that [u][i]won't open[/u] in a [u]new[/u] window[/i] for 10%-12% of the potential visitors to your site. [/B][/QUOTE]
Not at all; that's the desired outcome. Those of us who are happy and JavaScript free will be able to use the link but will not be forced to have a new window.

The handler "onclick" itself is defined in the HTML spec. but you use it to assign some script to the handler. To use it you need to put something like the following in your document's HEAD element to specify whata kind of script you will be using:

[font=monospace]<meta name="Content-Script-Type" content="text/javascript">[/font]

The [url=http://www.w3.org/TR/html401/struct/text.html#edef-EM]EM[/url] element denotes emphasis, the [url=http://www.w3.org/TR/html401/struct/text.html#edef-STRONG]STRONG[/url] element denotes strong emphasis and the [url=http://www.w3.org/TR/html401/struct/text.html#edef-P]P[/url] element denotes a paragraph. See http://www.w3.org/TR/html401/index/elements.html .
Copy linkTweet thisAlerts:
@MstrBobJan 30.2005 — [font=trebuchet ms][COLOR=royalblue][i]Originally posted by phpnovice [/i]

[B]I don't know why the PTB decided to remove [B]target[/B] from HTML 4.01. To my understanding, they did not even include it in the Frameset DTD -- where [B]target[/B] is most useful/needed. Also to my understanding, you will only find [B]target[/B] in the Transitional DTD. ? [/B][/QUOTE]


The Frameset DTD is actually a modified Transitional DTD. If you take a loot at it, they define the FRAMESET element and then include the Transitional DTD. Therefor, you can use the target attribute for frames, which was the original intention. The target attribute is used to specify a frame target.[/COLOR][/font]
Copy linkTweet thisAlerts:
@phpnoviceJan 30.2005 — [i]Originally posted by MstrBob [/i]

[B]The target attribute is used to specify a frame target.[/B][/QUOTE]

That part, I know.
[i]Originally posted by MstrBob [/i]

[B]The Frameset DTD is actually a modified Transitional DTD. If you take a loot at it, they define the FRAMESET element and then include the Transitional DTD. Therefor, you can use the target attribute for frames, which was the original intention.[/B][/QUOTE]

OK, so I shouldn't believe everything I'm told. ?
Copy linkTweet thisAlerts:
@phpnoviceJan 30.2005 — [i]Originally posted by CarolW [/i]

[B]1) Is that Javascript - that "onclick" directive? IF so, waht do I put in the <head> area of my document to allow it?[/B][/QUOTE]

It was spelled incorrectly in the original post but, no, the [b]onclick[/b] attribute is part of HTML -- however, it does refer to the use of some scripting language (e.g., JavaScript). If you want JavaScript then, technically, you don't absolutely need to specify anything in the HEAD section of your document as JavaScript is the default. However, it doesn't hurt to be explicit. As previously posted:

<meta name="Content-Script-Type" content="text/javascript">
[i]Originally posted by CarolW [/i]

[B]Seems to me I read somewhere that there are a few commands of just this sort that don't require Javascript, and perhaps "onclick" is one of them. (Says me, hoping, but doubtful.)[/B][/QUOTE]

Sorry, no such luck in this case. ?
[i]Originally posted by CarolW [/i]

[B]That "this href" isn't exactly what's needed there, is it? Does it stand for something more specific?[/B][/QUOTE]

Yes, that is [u][i]exactly[/i][/u] what is needed in this case. [B]this[/B] refers back to the current DHTML object, and [B]href[/B] refers to a property of that object. Once upon a time, however, some browsers would choke on the use of [B]this[/B] outside of a FORM.
Copy linkTweet thisAlerts:
@CarolWauthorJan 30.2005 — [i]Originally posted by Charles [/i]

[B]Not at all; that's the desired outcome. Those of us who are happy and JavaScript free will be able to use the link but will not be forced to have a new window.



The handler "onclick" itself is defined in the HTML spec. but you use it to assign some script to the handler. To use it you need to put something like the following in your document's HEAD element to specify whata kind of script you will be using:



[font=monospace]<meta name="Content-Script-Type" content="text/javascript">[/font]



The [url=http://www.w3.org/TR/html401/struct/text.html#edef-EM]EM[/url] element denotes emphasis, the [url=http://www.w3.org/TR/html401/struct/text.html#edef-STRONG]STRONG[/url] element denotes strong emphasis and the [url=http://www.w3.org/TR/html401/struct/text.html#edef-P]P[/url] element denotes a paragraph. See http://www.w3.org/TR/html401/index/elements.html . [/B]
[/QUOTE]


PHPNovice, my apologies for not replying directly to you; I was going to ask which 10 to 12% you were referring to, but I think Charles's post indicates which, in a way I understand. (Wow; beginnning to understand some things!)

So, Charles, you're talking design considerations for accessibility here. I've had old machines that wouldn't do much, and really struggled with them (my current machine was given to me by a person I call Angel Donor; it's not fancy, but it's better than just adequate - and came brand new, from my own chosen wonderful dealer!).

Thanks for the explanation of "em"; that helps.

I understand, then, about Javascript; not the details, but I have a friend who has offered to help me with my site, and he would surely help me with a script to handle the "onclick" instruction. Presumably, he'd also know how to redirect browsers that have Javascript turned off, or can't use it at all. I hope so!

Isn't [font] a deprecated tag? Or does that not apply in this situation? I'm in the process of changing my pages from HTML 4.01 Transitional to Strict. (Maybe I'm just completely out of context here; that could be.)

I thought a lot about the implications of forcing a browser to open a new window. On a machine low on system resources, that could get nasty.

Is there a way I could give a visitor an easy choice? Maybe not, but I have a feeling there would be. I visited a site referred to on one of these forums earlier today:

http://www.green-beast.com

and was very impressed at the design for accessibility, the choices given to the visitor. His home page is at:

http://gbhxonline.com

I'm going to go visit again. I tried changing the text size by clicking on the - what are they? whatever allows you to change the size. Very neatly done.

I'd like to allow my visitors that kind of choice, for anything that could affect the visitor's comfort and use of the machine.

There's one thing I remain concerned with, besides the major implications of adding Javascript to my so-far Javascript-free site.

That is, when I provide links to other sites.

I'm testing a free guestbook (with ads, though I hope my Javascript helper can do me a nicer guestbook that I can host on my own site). That one has a link to return Home after viewing or signing the (test) Guestbook, and there's still no Javascript on my own site for the moment, though there must be some kind of script involved on the offsite Guestbook.

But I also provide links to these forums and a couple of other resources, and also, links to sites of the very best (in my opinion) dog-trainers. When a visitor clicks on one of those, I'd like the visitor to be able to return easily to my own site, and that was the purpose of opening a new browser window. But maybe I'm wanting too much - that is, at too great a cost.

One of the sites I link to has offered to link to mine. The featured trainer at the other would be delighted, I'm sure, to link to my site, but the webmaster there is in a very different commercial set-up, not necessarily connected to the Star Trainer, as I could call her. Star Trainer, then, has little to say about what happens on the site where she provides crucial information, in articles and answering questions. So a person going there might lose contact with my site, OnClicking (just to make a bad pun) on the link I provide.

My current feeling is that I should just allow that loss, partly because of the implications of opening a new browser window if the vistitor is a novice surfer, or for whatever other reason.

I could certainly do that, leaving the need for opening a new browser window - just - out the window! Leaving my site still Javascript-free - for now. (But I do intend to ask my friend to contribute Javascript to my site, because I know he'll do it well, and I believe there will be things I'd like to do with Javascript.

Any comments? Charles? PHPNovice? Anybody else? I'm quite new at surfing myself, because my previous Windows machine, though it wasn't too bad, crashed a lot, even though I studied carefully, and learned how to maintain it as well as one could maintain a 1999 Win98SE machine. (My current machine is, I think of design around 2002 or 2003, running XP SP2. I only have 256 MB of RAM, and with that, manage to do all my own graphics (Paint Shop Pro 8) - and I take my own photos mostly, again, with a very simple ("cheapie") digital camera that Angel Donor gave me. (For a photography buff like me, I find it somewhat limiting, but there are still things you can do even with such simple and obsolete equipment.)

I guess my point is, making do for myself, but also for my visitors.

Also, Charles, amny thanks for the link to the elements information; I'll go there and study.

All comments welcome. Civil, or course <g>.
Copy linkTweet thisAlerts:
@CarolWauthorJan 30.2005 — Just reviewed the latest posts I haven't yet replied to; I may want to; for now, I've been burning the candle at both ends, and - uhhh, my dogs require their care - and I need a nap! Back later, with many, many thanks to all contributing to this thread. I'm really learning now, though it will take me some time to study all these details! You guys are the greatest!

Sun, 30 Jan 2005 11:12:29
Copy linkTweet thisAlerts:
@CharlesJan 30.2005 — [i]Originally posted by phpnovice [/i]

[B]If you want JavaScript then, technically, you don't absolutely need to specify anything in the HEAD section of your document as JavaScript is the default. [/B][/QUOTE]
[i]From the HTML 4.01 Strict:[/i]

[b]Authors should specify the default scripting language for all scripts in a document by including the following META declaration in the HEAD:



[font=monospace]<META http-equiv="Content-Script-Type" content="type">[/font]



where "type" is a content type naming the scripting language. Examples of values include "text/tcl", "text/javascript", "text/vbscript".



In the absence of a META declaration, the default can be set by a "Content-Script-Type" HTTP header.



[font=monospace]Content-Script-Type: type[/font]

where "type" is again a content type naming the scripting language.

User agents should determine the default scripting language for a document according to the following steps (highest to lowest priority):

  • 1. If any META declarations specify the "Content-Script-Type", the last one in the character stream determines the default scripting language.

  • 2. Otherwise, if any HTTP headers specify the "Content-Script-Type", the last one in the character stream determines the default scripting language.


  • Documents that do not specify default scripting language information and that contain elements that specify an intrinsic event script are incorrect. User agents may still attempt to interpret incorrectly specified scripts but are not required to. Authoring tools should generate default scripting language information to help authors avoid creating incorrect documents.[/b]

    [i] http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.2 [/i][/quote]
    Copy linkTweet thisAlerts:
    @phpnoviceJan 30.2005 — It is a good and excellent thing that browser manufacturer's aren't as anal-retentive as those that draft such documents nor as those that feel the need to post them.
    Copy linkTweet thisAlerts:
    @ray326Jan 30.2005 — [i]Originally posted by phpnovice [/i]

    [B]It is a good and excellent thing that browser manufacturer's aren't as anal-retentive as those that draft such documents nor as those that feel the need to post them. [/B][/QUOTE]
    And to that I give a hardy Bovine Excrement. If they were then we would be able to code to the single spec and all browsers would work correctly. Or is it that you prefer the chaos as a form of job security?
    Copy linkTweet thisAlerts:
    @CarolWauthorJan 31.2005 — Rubbing my eyes after a long nap - <hehe> are we on a snipe hunt?

    I do think the world of incompatibility between browser-renderings (if that actually means anything) is unfortunate (to be a bit deadpan and civil about it <g>). And it can be funny (not to mention difficult for me) to read standards, say, on W3C - Charles, thanks for that very useful long quote!

    As for anal-retentive, if nobody's yet figured out that I am, when it comes to standards - it has to do with semantics, which concerns meanings. Communication being my lifelong passion, I generally hope for precision and exactness in meaing, and in communication about meanings, so of course my predilection becomes obvious <SNORTLE!>

    Hey, guys, I don't know how tolerant the moderator here is of sniping, but you guys, besides being delightfully helpful, do occasionally, I think, succumb to the temptation to snipe, especially when sniped at. <g>.

    I just don't wnat to lose the great parts of this thread. But a new one could always be started.

    Perhaps it's my female predilection that leads me to wonder how males can trigger so easily when sniped at. It's not uncommon for females just to laugh and let go. (I gotta admit, though, that not all females necessarily have that same tendency; we can be just as snipy as, sometimes worse than, the men!)

    I see I'm babbling, so I'll probably shut up till tomorrow at least - hey, I need to go make use of what I'm being taught here!

    Sun, 30 Jan 2005 18:03:39
    Copy linkTweet thisAlerts:
    @phpnoviceJan 31.2005 — [i]Originally posted by ray326 [/i]

    [B]Or is it that you prefer the chaos as a form of job security? [/B][/QUOTE]

    On the contrary... I prefer a browser that has the intelligence to make a simple decision to adopt a default in the absence of an explicit specification. Naturally, such a default should be the client scripting language that started it all -- JavaScript. If the coder doesn't like the default, then let them give an explicit specification. This is not chaos. This is harmony.
    Copy linkTweet thisAlerts:
    @CharlesJan 31.2005 — I'm always amazed at just how many people there are who consider themselves to be smarter and wiser than the combined efforts of everybody at the W3C.
    Copy linkTweet thisAlerts:
    @phpnoviceJan 31.2005 — It is not a question of "smarter/wiser", in this case. It is a matter of common sense. Yes, I've had conversations with many, many people (far more in number than the number involved in the drafting of such standards in the first place) that feel the W3C demonstrates a gross lack of ordinary and common sense -- and I agree with those people. :p

    The thing you are unable to understand (and others that have adopted your practices), Charles (and I speak from having watched for about two years worth of your diatribes with various members of this board), is the difference between [u]having[/u] standards (which is a good thing) and how those standards are [u]applied[/u]. The difference is analogous to a democracy and communism, respectively.

    I'll not reply further to this thread as, from experience, such replies are futile.

    Cheers.
    Copy linkTweet thisAlerts:
    @CarolWauthorJan 31.2005 — [i]Originally posted by phpnovice [/i]

    [B]



    <snip>



    I'll not reply further to this thread as, from experience, such replies are futile.



    Cheers. [/B]
    [/QUOTE]


    Well, please don't go away. I'll look for you in other threads. I believe you have something there, about common sense and standards - but don't know nearly enough to detect detailed content in what you're saying, nor in what Charles is saying, either! Meaning, I literally don't know what you're talking about <g>.

    Seems to me a browser should provide defaults, and also that standards should be meaningful and not "ridiculous," whatever that is! I just don't have anything like enough experience to know which is what.

    I miss target="_blank" - but neither you nor Charles responded to that aspect of my question. I gather that "forcing" a new browser window to open might really be an offensive thing to do to a person visiting your site, or even following a link from your site to another. And that the current W3C standard for HTML 4.01 Strict doesn't allow either use; that it's intended to work with frames (and believe it or not, I understand that!

    Mon, 31 Jan 2005 07:07:10
    Copy linkTweet thisAlerts:
    @phpnoviceJan 31.2005 — [i]Originally posted by CarolW [/i]

    [B]Well, please don't go away. I'll look for you in other threads.[/B][/QUOTE]

    Sorry, I did not mean to say that I would not reply to you. ? Always willing to reply to someone that has the ability to be reasonable.
    [i]Originally posted by CarolW [/i]

    [B]I miss target="_blank" - but neither you nor Charles responded to that aspect of my question.[/B][/QUOTE]

    Yes, that is an example of one of the things that makes me scratch my head where the W3C is concerned. I've never gotten a really good answer as to why the W3C turned there noses up to both frames and targets. I say they turned their noses up at these (and other) HTML entities based on the fact that they are not part of the so-called "strict" standard.
    Copy linkTweet thisAlerts:
    @CharlesJan 31.2005 — The W3C hasn't really turned its back on frames, and they haven't asked us to stop using the "target" attribute. It's just that they are working on [url=http://www.w3.org/TR/xframes/]XFrames[/url], the next upgrade.
    Copy linkTweet thisAlerts:
    @phpnoviceJan 31.2005 — [i]Originally posted by Charles [/i]

    [B]...they are working on [url=http://www.w3.org/TR/xframes/]XFrames[/url], the next upgrade. [/B][/QUOTE]

    Whoa! As long as we're speaking reasonably, I'll jump back in here.

    I though I saw somebody post a statement that there would be no new versions for HTML, as it is supposedly "stabilized" -- or some such.

    EDIT: Oh, I just read a bit of it... It is for XML -- not HTML. So, the fact remains that frames and targets were purposefully excluded from "strict" HTML 4.01.
    Copy linkTweet thisAlerts:
    @MstrBobFeb 01.2005 — [font=trebuchet ms][COLOR=royalblue]And there is a reason for such. HTML 4 was created to bring back universiality to the web. By HTML 3.2, there was so much inconsitancy on the web that something needed to be done. HTML 4.01 brings us back to the core idea of a markup language, which is to mark up documents in a meaningful way and so that computers can understand it. HTML 4.01 Strict is this reached goal, a markup language that can be utilized by a myriad of user-agents.



    The problem is that Frames become an issue with this. How does an audiobrowser deal with frames? Or a search engine? or other devices. Since this becomes such an issue, and the goal of HTML 4.01 Strict is to be the most accessible markup language, frames were removed. In addition, the target attribute was removed since it's purpose was to target frames. Frames are still available, however, and can be used it needed. Both HTML and XHTML 1.0 include Frames support. But the W3C wishes to rectify the problems with frames in its new technology, XFrames.



    Frames weren't removed because the W3C was being illogical or picky. [/COLOR]
    [/font]
    Copy linkTweet thisAlerts:
    @CarolWauthorFeb 01.2005 — Charles, PHPnovice and MstrBob, it's wonderful for me to watch you conversing about these things. It helps orient me to what I'm doing, and to thinking more about how I might want to do it. Although, no question, the road is long for me, and at my age, I might stop at a certain point, since my primary interest is really communicating about life, from my site, rather than the deeper questions concerning accessible web design, or even gorgeous web design!

    And I don't think anybody need take offense at a difference of opinion; not at the level of knowledge you people have.

    The more I read here, the gladder I am I decided to move to Strict (HTML 4.01) from Transitional, but, again, that will take me quite a while. I'm getting the idea, though, again thanks to help from many people, for now, primarily, you, MstrBob.

    My next lesson needs to be, knowing when to leave the computer long enough so my eyes continue to work <g>.

    Mon, 31 Jan 2005 17:01:43
    ×

    Success!

    Help @CarolW spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...