Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I suggest <em>not</em> adding in the target attribute. It was dropped due to accessibility reasons, and I dislike it when the <em>page</em> decides for <em>me</em> how my browser tags open. Of course, you are free to do so, if you wish to. I will show you a JavaScript method that Darin mentioned above that allows you to validate as XHTML 1.0 Strict or XHTML 1.1:</p> <p>HTML code:</p> <pre class="lang-html prettyprint-override"><code>&lt;!-- Added link titles for better testing purposes --&gt; &lt;ul id="socialnetwork"&gt; &lt;li&gt;&lt;a href="http://www.twitter.com/" class="targetblank"&gt;Twitter&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.flickr.com/" class="targetblank"&gt;Flickr&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.xing.com/" class="targetblank"&gt;XING&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.rss.com/" class="targetblank"&gt;RSS&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>JavaScript code:</p> <pre class="lang-js prettyprint-override"><code>window.onload = function() { // Code if document.getElementByClassName() doesn't exist if (document.getElementsByClassName == undefined) { document.getElementsByClassName = function(className) { var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)"); var allElements = document.getElementsByTagName("*"); var results = []; var element; for (var i = 0; (element = allElements[i]) != null; i++) { var elementClass = element.className; if (elementClass &amp;&amp; elementClass.indexOf(className) != -1 &amp;&amp; hasClassName.test(elementClass)) results.push(element); } return results; } } var anchorList = document.getElementsByClassName('targetblank'); for (var i in anchorList) { anchorList[i].target = '_blank'; } } </code></pre> <p>Of course, you can omit the window.onload if you already include it elsewhere, but I recommend using it (or using another load function, such as JQuery's <code>$(document).ready();</code>) so the JavaScript loads when the page finishes loading. Now, all you need to do is give each anchor link a class of "<code>targetblank</code>", and the links should open in a new tab.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload