Link code to open new window without depreciated attributes

Discussion in 'HTML & Website Design' started by Josh Inno, Dec 20, 2006.

  1. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #21
    I have used this code and it seems to work OK. It might be one idea for you
     
    Corey Bryant, Dec 26, 2006 IP
    Josh Inno likes this.
  2. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Thanks for the Link Corey. I may check that bit of code out and compare.
     
    Josh Inno, Dec 26, 2006 IP
  3. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #23
    So do those with screen readers and braille pads experience errors with the java 'enhanced' links, or do they remove them? What occurs with the 'target' tag?

    By "Degrades gracefuly" do you mean that if the Javascript does not work (due to it being disabled, or the like) that it does not cause the link to break?

    Also, is it possible to make this bit of JavaScript a part of CSS, or some other external file?
     
    Josh Inno, Dec 26, 2006 IP
  4. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #24
    if you are referring to my link - it is an external JS file and you cannot add it to a CSS file. You might be able to add it to another external JS file
     
    Corey Bryant, Dec 27, 2006 IP
  5. MTbiker

    MTbiker Well-Known Member

    Messages:
    2,536
    Likes Received:
    123
    Best Answers:
    0
    Trophy Points:
    170
    #25
    MTbiker, Dec 27, 2006 IP
  6. livingearth

    livingearth Well-Known Member

    Messages:
    1,469
    Likes Received:
    83
    Best Answers:
    0
    Trophy Points:
    140
    #26
    Just what is the advantage of coding it as "strict" rather than "transistional"?
    I would produce what my boss requested unless the page contains code which requires full compliance to "strict" guidelines. So far the only thing I have found which forced me to strict was some experiments w/Google api mapping code.
     
    livingearth, Dec 27, 2006 IP
  7. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #27
    Well according to some resources I've seen, IE gets really stupid about some code from the new standard unless the page validates as strict compliant.

    And I do fully intend to produce as directed by my boss, I'm just looking to see if I can find some options that live up to strict, without using code IE doesn't support, so that I don't have to worry about cross-browser compatibility issues quite as much.

    I'm hoping to find flexible options (hopefully some that can be pulled into an external file) so that I can offer increased functionality to him over and above what he requested. For example, if there's a way to pull that Javascript code into an external file, then the include at the bottom of the page, on EVERY page we produce, which links back to a single file on our server, can be more flexibly implemented between pages.

    So that if a client requests that we -don't- have an 'open in new window' popup, we can accommodate that request, without having to remove that functionality from other client's websites.

    The target= attribute is currently on an include on our personal server, as it's a 'credit' link, and links back to our company website. Something along the lines of "produced by" we've got everything pointing to it as an include so that we can change that one file, and update the credit line on all of the websites we produce, rather than having to go and fiddle with every single one.

    The rel="external" attribute, combined with the above code might just work for that, now that I think about it.

    Did any of that make sense, or was I just blathering?
     
    Josh Inno, Dec 27, 2006 IP
  8. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #28
    Dan Schulz, Dec 27, 2006 IP
    Josh Inno likes this.
  9. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #29
    Open a page in your browser, and turn styles off. This will be simpler if you use Firefox. Now close your eyes and have someone read the page to you. Tab down to a link that opens a new window, and hit enter (remember, you're using a "screen reader"). Now go 'back' to the original page.

    Yes.

    Not a part of css, but the onclick event handlers are best added by an external javascript.

    cheers,

    gary
     
    kk5st, Dec 27, 2006 IP
  10. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #30
    Thanks for all of the help guys. I guess I'm going to have to start learning Java script now as well as PHP, CSS, and HTML... not sure when I'll get the time to look into XML in any depth.
     
    Josh Inno, Dec 27, 2006 IP
  11. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #31
    Stick with HTML and CSS for now. PHP really isn't needed (except for includes) unless you're writing or modifying a CMS or need to write some custom scripts. There is a lot more to learn than just HTML and CSS though. You have to learn about browser quirks, bugs, which HTML elements and CSS properties are supported by which browsers, what works cross-browser and what doesn't... not to mention making your sites accessible and usable as well.
     
    Dan Schulz, Dec 27, 2006 IP
  12. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #32
    Aye. I'm still working on all of that. *sigh*

    Although I am already working with PHP forms for clients, it's mostly just editing values to point to the right page. Also, I'm hoping to write a script, in the near future, to count the number of sub-directories that the user is trying to access, and then apply a ../ for each one to get back to root before I use a rel structure to point to the actual location of a file. Yes, I know the same thing could be done with a static link, but then I couldn't move the file to a different domain without having to go back and find everyplace I broke a link.
     
    Josh Inno, Dec 27, 2006 IP
  13. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #33
    By the way. What is the reason for the
    
    return false;
    
    Code (markup):
    Part of the code on some of the java code listed above?
     
    Josh Inno, Dec 27, 2006 IP
  14. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #34
    You mean JavaScript code right? That tells the browser to ingore the default behavior and to use the new one (the one supplied by the script) instead.
     
    Dan Schulz, Dec 27, 2006 IP
  15. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #35
    *Sigh* yes. Sorry. I'm used to shortening the names of things, but in this case it would cause me to refer to the wrong type of code, so I'll have to break myself of that habit. Sorry.

    So the default behavior is to use the link code and open it in a new window, but the javascript behavior is to open it in a new window. I tried a supplied code without 'return false;' and it worked fine though. Is this code used for cross browser/server reasons?
     
    Josh Inno, Dec 28, 2006 IP
  16. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #36
    If you don't use the return false, the html link will fire, opening the new page in the current window, assuming you're using the code I gave you. If you use Corey's code, it's attaching the target attribute programmatically.

    cheers,

    gary
     
    kk5st, Dec 28, 2006 IP
  17. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #37
    Thanks again for all the help guys.

    And I took another look at Corey's code link again, and took a longer look a the surrounding discussion, and I think I can get an external link new window generator going. Reading through the code, I think I'm starting to understand some of the calls and what not. At least enough to change it so that if rel=nofollow I can have it pop a window open that way too.

    Now just to make sure, this is something that won't insert the target="_blank" attribute into the actual code like php would, right?
     
    Josh Inno, Dec 28, 2006 IP
  18. MTbiker

    MTbiker Well-Known Member

    Messages:
    2,536
    Likes Received:
    123
    Best Answers:
    0
    Trophy Points:
    170
    #38
    The rel="external" method will not insert the target blank into the page.
     
    MTbiker, Dec 28, 2006 IP
  19. Josh Inno

    Josh Inno Guest

    Messages:
    1,623
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #39
    Thank you MTbiker for your assistance. Hopefully when my boss comes in later today I can talk to him about this external method that will allow us to make the choice about opening a new window site by site, so that we can comply with future client requests more easily.
     
    Josh Inno, Dec 28, 2006 IP