Hey everyone I have a question? I know the html for making a link with my url: <a href= "landing page url">click here</a> but what is the html for making my link after it is clicked to appear in a new window not the same window, and yes I did a search and tried looking it up on search engines as well. Please help, I know it's a newbie question. thanks for your time.
Just don't use it : ) Target="blank" sucks for accessiblity. It's also been deprecated-- so depending on what doctype you're using, it may or may not validate (strict will not validate). There is also a Javascript solution for people who want to be valid yet open new windows. But again, it really should be avoided-- people love to use the Back button and they do-- most-used button there is. If they want to go back to your page, they'll hit the Back button-- a new window doesn't allow that.
JavaScript: function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external" || anchor.getAttribute("rel") == "external nofollow" ) anchor.target = "_blank"; } } window.onload = externalLinks; Code (markup): then: <a href="http://www.domain.html" rel="external">link</a> very accessible, and works as a normal link without JS enabled.
use the solution I posted above - i promise that it's the best way to go... liek Stomme poes said, don't use target="blank"
Yeah but sometimes people come to you asking for blow on a crackpipe or how to lock a puppy in a refrigerator and while it's okay to say "Here's how you could do that" you should also always warn them why it's not a good idea. : )
Can somebody do an actual link using this code for me, say using this url as an example....I have tried to use it and I can't get it to work....obv, I am a total and utterly hopless newbie who really wants to learn.
save the code in an external .js file, and link it in the header. see an example on this foremost news page. (the external link is the "microban website" one towards the bottom.