• How can I edit the rss widget so that clicking a link contained withing the rss will open up a new window ?

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Generally speaking, the Web 2.0 world frowns on attempting to force the browser to use new windows and such. This is why target has been removed from XHTML 1.0 Strict. It’s still there (but deprecated) in Transitional, but it’s frowned upon. Doesn’t work with a lot of modern browsers anyway (Firefox) as these browsers often redirect new windows to Tabs or whatever.

    Still, you can try to do it with a bit of javascript. Try putting this into your theme’s header (inside the <head> tags):

    <script type="text/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("class") == "rsswidget")
         anchor.target = "_blank";
     }
    }
    window.onload = externalLinks;
    -->
    </script>
Viewing 1 replies (of 1 total)
  • The topic ‘How to edit the RSS widget to make links open in new window’ is closed to new replies.