Support » Plugin: Link Indication » [Plugin: Link Indication] rel="external" instead of target="_blank"

  • I’ve changed the code starting at line 212 in order to substitute the target attribute by the rel=”external”. As the author say the target attribute isn’t W3C valid, so why not get rid of it definitely.

    /**********************
    * For external links, we apply target="_blank" (if there is not already a target attribute in the anchor tag)
    *********************/
    $targetblank = '';
    if ( (substr($linktype, 0, 8) == 'external') && ($this->g_opt['mwli_targetblank'] == '1') ) {
    //if ( (strpos($matches[1] . $matches[6], 'target=') === false) ) {
    if ( ! preg_match("/rel=[\"\'].*?external.*?[\"\']/i", $matches[1] . $matches[6] ) ) {
    // there is no target=, so we add target="_blank"
    //$targetblank = 'target="_blank"';
    $targetblank = 'rel="external"';
    }
    }

    If Someone needs desperately to open a external link in another window, she could add a Jquery like:

    <script>
    $(function() {
    $(‘a[rel*=external]‘).click( function() {
    window.open(this.href);
    return false;
    });
    });
    </script>

    http://wordpress.org/extend/plugins/link-indication/

  • The topic ‘[Plugin: Link Indication] rel="external" instead of target="_blank"’ is closed to new replies.