On Thu, Jun 19, 2008 at 12:19 PM, Joel Perras <[EMAIL PROTECTED]> wrote:
>
> Basically, all it does is pull the favicon.ico from any external links
> contained on my page and appends them to the end of the link.  It's
> quite simple, and works wonderfully _except_ in IE7.

Say, that's pretty neat!

I managed to get it working on IE by inserting a string rather than an
Element object. (A bit icky from a standards perspective, I realize,
but then IE is an icky browser.) Exactly why the former works and the
latter doesn't is a mystery to me, so if anybody knows more, do tell
:)

You can still keep configuration and readability by using Prototype's
very cool String.interpolate. Here's what I came up with:

favicon = '<img class="#{className}" src="#{src}" alt="#{alt}"
onerror="#{onError}" />'.interpolate({
  className: 'favicon',
  src: link.href.replace(/^(http:\/\/[^\/]+).*$/, '$1') + '/favicon.ico',
  alt: 'external link',
  onError: 'javscript:$(this).remove()'
});

Very cool idea. I may just have to look for places to use this now :)

:Dan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to