www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 25

Thread: target="_blank" - oops (from transitional to strict)

Hybrid View

  1. #1
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    330

    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>
    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

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    <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>


    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: <p>Hello, <em>World!</em> in place of <p>Hello,<em> World!</em>.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    330
    Originally posted by Charles
    <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>


    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: <p>Hello, <em>World!</em> in place of <p>Hello,<em> World!</em>.
    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

  4. #4
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    330
    Originally posted by Charles
    <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>


    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: <p>Hello, <em>World!</em> in place of <p>Hello,<em> World!</em>.
    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

  5. #5
    Join Date
    Dec 2004
    Posts
    8,637

    Re: target="_blank" - oops (from transitional to strict)

    Originally posted by CarolW
    In order to validate the page as strict HTML, I removed the

    target="_blank"

    And the file validated as strict.
    I don't know why the PTB decided to remove target from HTML 4.01. To my understanding, they did not even include it in the Frameset DTD -- where target is most useful/needed. Also to my understanding, you will only find target in the Transitional DTD.
    Last edited by phpnovice; 01-30-2005 at 12:23 PM.

  6. #6
    Join Date
    Dec 2004
    Posts
    8,637
    Originally posted by Charles
    <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>
    I guess Charles doesn't mind suggesting code to you that won't open in a new window for 10%-12% of the potential visitors to your site.

  7. #7
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    Originally posted by phpnovice
    I guess Charles doesn't mind suggesting code to you that won't open in a new window for 10%-12% of the potential visitors to your site.
    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:

    <meta name="Content-Script-Type" content="text/javascript">

    The EM element denotes emphasis, the STRONG element denotes strong emphasis and the P element denotes a paragraph. See http://www.w3.org/TR/html401/index/elements.html .
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  8. #8
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771

    Re: Re: target="_blank" - oops (from transitional to strict)

    Originally posted by phpnovice
    I don't know why the PTB decided to remove target from HTML 4.01. To my understanding, they did not even include it in the Frameset DTD -- where target is most useful/needed. Also to my understanding, you will only find target in the Transitional DTD.
    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.

  9. #9
    Join Date
    Dec 2004
    Posts
    8,637

    Re: Re: Re: target="_blank" - oops (from transitional to strict)

    Originally posted by MstrBob
    The target attribute is used to specify a frame target.
    That part, I know.
    Originally posted by MstrBob
    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.
    OK, so I shouldn't believe everything I'm told.

  10. #10
    Join Date
    Dec 2004
    Posts
    8,637
    Originally posted by CarolW
    1) Is that Javascript - that "onclick" directive? IF so, waht do I put in the <head> area of my document to allow it?
    It was spelled incorrectly in the original post but, no, the onclick 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">
    Originally posted by CarolW
    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.)
    Sorry, no such luck in this case.
    Originally posted by CarolW
    That "this href" isn't exactly what's needed there, is it? Does it stand for something more specific?
    Yes, that is exactly what is needed in this case. this refers back to the current DHTML object, and href refers to a property of that object. Once upon a time, however, some browsers would choke on the use of this outside of a FORM.
    Last edited by phpnovice; 01-30-2005 at 01:41 PM.

  11. #11
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    330
    Originally posted by Charles
    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:

    <meta name="Content-Script-Type" content="text/javascript">

    The EM element denotes emphasis, the STRONG element denotes strong emphasis and the P element denotes a paragraph. See http://www.w3.org/TR/html401/index/elements.html .
    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>.

  12. #12
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    330
    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

  13. #13
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    Originally posted by phpnovice
    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.
    From the HTML 4.01 Strict:
    Authors should specify the default scripting language for all scripts in a document by including the following META declaration in the HEAD:

    <META http-equiv="Content-Script-Type" content="type">

    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.

    Content-Script-Type: type

    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.

    http://www.w3.org/TR/html401/interac....html#h-18.2.2
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  14. #14
    Join Date
    Dec 2004
    Posts
    8,637
    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.

  15. #15
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Originally posted by phpnovice
    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.
    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?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles