Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Scripting > Javascript   »   Force javascript newsfeed items to open in new window?

 
Question Tools Search this Question Display Modes
Question
 
 
#1  
Old Sep 19, 2007, 07:52 AM
RickJ's Avatar
RickJ
Administrator
RickJ is offline
 
Join Date: Aug 2005
Location: Cave 4, Qumran
Posts: 6,889
RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.
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!

Reply With Quote
 
     

Answers
 
 
Old Sep 19, 2007, 08:24 AM   #2  
Curlyben
Administrator
Curlyben is offline
 
Curlyben's Avatar
 
Join Date: Mar 2005
Location: Behind You !!
Posts: 5,774
Curlyben See this member's comment history on his/her Profile page.Curlyben See this member's comment history on his/her Profile page.Curlyben See this member's comment history on his/her Profile page.Curlyben See this member's comment history on his/her Profile page.Curlyben See this member's comment history on his/her Profile page.Curlyben See this member's comment history on his/her Profile page.
Call Curlyben via Skype™
have you tried target="_blank"
  Reply With Quote
 
     
 
 
Old Sep 19, 2007, 09:59 AM   #3  
RickJ
Administrator
RickJ is offline
 
RickJ's Avatar
 
Join Date: Aug 2005
Location: Cave 4, Qumran
Posts: 6,889
RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.
Yeah, tried it in a few places in there and none worked.
  Reply With Quote
 
     
 
 
Old Sep 19, 2007, 10:16 AM   #4  
retsoksirhc
Senior Member
retsoksirhc is offline
 
retsoksirhc's Avatar
 
Join Date: Mar 2004
Location: Michigan
Posts: 742
retsoksirhc See this member's comment history on his/her Profile page.
Send a message via AIM to retsoksirhc
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...
  Reply With Quote
 
     
 
 
Old Sep 19, 2007, 10:23 AM   #5  
RickJ
Administrator
RickJ is offline
 
RickJ's Avatar
 
Join Date: Aug 2005
Location: Cave 4, Qumran
Posts: 6,889
RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.
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.
  Reply With Quote
 
     
 
 
Old Sep 19, 2007, 12:20 PM   #6  
jstrike
Full Member
jstrike is offline
 
Join Date: May 2007
Location: Wisconsin - Go Packers!
Posts: 385
jstrike See this member's comment history on his/her Profile page.
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

Comments on this post
RickJ agrees: Thank you! You're too cool!
retsoksirhc agrees: Daayum. I really need to learn more about DIV's and Javascript. That's pretty awesome.
  Reply With Quote
 
     


Question Tools Search this Question
Search this Question:

Advanced Search
Display Modes

 
Similar Sponsors

Similar Questions
Question Asker Topic Answers Last Post
Open Desktop Shortcut in New Window Realtor Girl Internet Explorer 2 Feb 15, 2007 02:17 PM
PAINT in window xp failed to open johnehlim Windows 2 Feb 4, 2007 10:50 PM
Javascript: How to refer to a child window xuanmanh Internet & the Web 7 Jun 30, 2006 02:45 AM
Open Internet explorer in new window? ca79girl Internet & the Web 5 Jan 26, 2006 03:06 PM
No items listed in shutdown window drop down krisal Windows 3 Dec 1, 2005 09:28 AM




Copyright ©2003 - 2007, Ask Me Help Desk.
All times are GMT -8. The time now is 09:44 PM.

Content Relevant URLs by vBSEO 3.0.0 RC6 © 2006, Crawlability, Inc.