Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Design

make all links (in rss) open in a browser

Author Message
noahd



Joined: 09 Jan 2007
Posts: 4

Posted: Tue Jan 09, 2007 - 7:26 pm    Post subject: make all links (in rss) open in a browser Reply with quote

i know a lot of threads have been started on this already, but i;m still confused.

i have a podcast rss widget and i would like the mp3, text, and image links to all open in a browser instead of the widget

any ideas?

thanks,
noahd
View user's profile Send private message Send e-mail Widgets
EricWood



Joined: 20 Nov 2006
Posts: 26
Location: Austin

Posted: Tue Jan 09, 2007 - 10:38 pm    Post subject: Reply with quote

Luckily, I can answer your question in one line of code:
Code:
widget.openURL("your url or whatever");
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
noahd



Joined: 09 Jan 2007
Posts: 4

Posted: Wed Jan 10, 2007 - 1:49 am    Post subject: Reply with quote

thanks for the quick reply!
the blog that the rss is from has "a href" links in the posts.
is there a way that i can automatically replace the "a href" links with the code you suggested?
i'm in way over my head as far as writing a javascript search/replace or whatever the apropriate method would be.
thanks,
noahd
View user's profile Send private message Send e-mail Widgets
EricWood



Joined: 20 Nov 2006
Posts: 26
Location: Austin

Posted: Wed Jan 10, 2007 - 8:21 am    Post subject: Reply with quote

You're using the wrong approach. Instead of changing the hrefs, just take the contents of the href into a function.
Code:
var link = element.href;
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
noahd



Joined: 09 Jan 2007
Posts: 4

Posted: Wed Jan 10, 2007 - 8:29 pm    Post subject: Reply with quote

so, that code you posted looks similer to some code that is in a widget i looked at that has working links.

here are the pieces of code that seem to relate(?)
Code:
//---------------------------------------------------------------------------------------------
//   fixLinks()
//   Correct hyperlinks in a document fragment to use the openURL function.
//---------------------------------------------------------------------------------------------
function fixLinks(htmlFragment)
{
   // Collect all the links
   var links = htmlFragment.getElementsByTagName("a");
   for (var i = 0; i < links.length; i++) {
      var aNode = links[i];
      // Send them to our clickOnLink function
      aNode.onclick = clickOnLink;
   }
}



and
Code:
//---------------------------------------------------------------------------------------------
//   clickOnLink()
//   Open in the browser instead of in the widget.
//---------------------------------------------------------------------------------------------
function clickOnLink()
{
   if (window.widget) {
      widget.openURL(this.href);
      return false;
   }
}



here's my widget: http://deezlee.com/JohnHenryRadioInProgress.wdgt.zip


so would i alter that code and incorperate it? and if that's the right approach, how do i do it? thanks again for the advice.

p.s. this widget not a commercial product, i'm making it for free for a friend so he can promote his music.

peace,
noahd
View user's profile Send private message Send e-mail Widgets
noahd



Joined: 09 Jan 2007
Posts: 4

Posted: Sat Jan 13, 2007 - 12:10 am    Post subject: Reply with quote

anyone?
View user's profile Send private message Send e-mail Widgets
EricWood



Joined: 20 Nov 2006
Posts: 26
Location: Austin

Posted: Sat Jan 13, 2007 - 12:15 am    Post subject: Reply with quote

Sorry, but most of us are busy writing code for our own projects. I wish I could help more, but school keeps me busy.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group