Ask Experts Questions for FREE Help !
Ask
    RickJ's Avatar
    RickJ Posts: 7,762, Reputation: 864
    Uber Member
     
    #1

    Sep 19, 2007, 08:52 AM
    Force javascript newsfeed items to open in new window?
    I've got this javascript newsfeed on a webpage.

    Code:
    <SCRIPT language=JavaScript src='http://www.gop.com/Feeds/NewsFeed-Wide.aspx'></SCRIPT>
    Is there a way to make the link items in it open in a new window/tab?

    Thanks!
    Curlyben's Avatar
    Curlyben Posts: 18,514, Reputation: 1860
    BossMan
     
    #2

    Sep 19, 2007, 09:24 AM
    have you tried target="_blank"
    RickJ's Avatar
    RickJ Posts: 7,762, Reputation: 864
    Uber Member
     
    #3

    Sep 19, 2007, 10:59 AM
    Yeah, tried it in a few places in there and none worked.
    retsoksirhc's Avatar
    retsoksirhc Posts: 912, Reputation: 71
    Senior Member
     
    #4

    Sep 19, 2007, 11:16 AM
    Since you're not actually controlling the feed page yourself, there isn't really any easy way to do it.

    You could write a server side script that reads the news page, sorts through it, and adds a
    Code:
    target="blank"
    To all the
    Code:
    <a href="http"//pagename/story.aspx">Link Text</a>
    That would be about it...
    RickJ's Avatar
    RickJ Posts: 7,762, Reputation: 864
    Uber Member
     
    #5

    Sep 19, 2007, 11:23 AM
    Thanks sirhC.

    That hurt my brain to read it :) so I'll just nix the feed. Not that important to have it on my site... I just discovered it while rooting around the supplier's site.
    jstrike's Avatar
    jstrike Posts: 418, Reputation: 44
    Full Member
     
    #6

    Sep 19, 2007, 01:20 PM
    Actually it's not really that bad with a few lines of JavaScript...
    Code:
    <div id="newsSource">
      <SCRIPT language=JavaScript src='http://www.gop.com/Feeds/NewsFeed-Wide.aspx'></SCRIPT>
    </div>
    <script>
      var regExp = /<a /ig;
      var newsFeed = document.getElementById("newsSource"); 
      var newsFeedSrc = newsFeed.innerHTML;
      newsFeedSrc = newsFeedSrc.replace(linkRegEx,"<A target='_blank' ");
      newsFeed.innerHTML = newsFeedSrc;
    </script>
    Every link in the feed will now open in a new browser window, even the gop.com link in the footer.

    HTH,
    -Jeff

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search


Check out some similar questions!

Open Desktop Shortcut in New Window [ 2 Answers ]

Recently, our real estate multiple list service began using a program that is internet based, which works fine. We also access our county assessor's records on the internet. My problem occurs when I am working in the multiple list and need to check the assessor's records. I have a shortcut on my...

PAINT in window xp failed to open [ 2 Answers ]

Just don't understand, my PAINT JUST failed to open, any one can help?

Javascript: How to refer to a child window [ 7 Answers ]

supposing I have opened a new window with this statement: newwin=window.open("newwin.php","newwindow"); Now I refresh the opener window and I want to know how to refer to the window I have opened?

Open Internet explorer in new window? [ 5 Answers ]

Please help! I have figured out how to do just about everything I want except open a new window when I click on a link. I have windows xp professional version 2002 service pack 2. I can not figure this out :eek: anyone know how?

No items listed in shutdown window drop down [ 3 Answers ]

I have a XP user that has no items listed in the drop down in the shut down window, any body got any Ideas


View more questions Search