Extension talk:FaviconLink
Here's a link to various Microsoft Office and Windows programs.--Hoggwild5 02:09, 18 February 2007 (UTC)
I added the XSS alert because this works:
- <ilink>"><script>alert('hello');</script></ilink>
Some Improvements
editThere are two issues with the current version:
- if the target site has no favicon, an ugly placeholder is shown
- some sites use favicons larger than the usual 16x16 pixels, this may look bad especially in lists of links
Replacing
return "<a href=\"".$link."\"><img src=\"".$favicon."\"> ".$linkname."</a>";
with
$headers = @get_headers($favicon); $iconExists = (preg_match("|200|", $headers[0]) != 0); // check for the HTTP return code; 200 means 'OK' global $wgIconLinkDefaultIcon; if (! $iconExists) { $favicon = $wgFaviconLinkDefaultIcon; } return '<a href="'.$link.'"><img src="'.$favicon.'" width="16" height="16"> '.$linkname.'</a>';
should solve these issues. The default icon can be defined in LocalSettings.php
:
$wgFaviconLinkDefaultIcon = "extensions/FaviconLink/default.png";
Roberthaenel 19:29, 4 March 2008 (UTC)
Hi @Roberthaenel,
Great - your improvment code works! But sorry for asking - I do not understand what exactly should be shown/appear as result, IF the target site has no favicon (e.g. an icon, so that all links and favicons are -vertically- in line)?
I mean, if through your new code simply no favicon should appear (because the site simply do not have a favicon), I think in this case I would simply not use the <ilink>-extension(-tags) OR would simple replace it (instead a placeholder or whatever) through the browsers "no favicon icon" or maybe any other icon. Therefore, it would be a nice next improvement, if your code would be able to automatically replace the "no icon place" with the browsers "no favicon icon" (similar as browsers do so in such a case) or a possibility to replace the "no favicon place" with any other -wished- icon (or maybe a possibility to use both examples) ...
--80.109.228.11 17:08, 3 April 2008 (UTC)
Hi 80.109.228.11
I have updated the code to show a default icon.
Roberthaenel 18:02, 5 April 2008 (UTC)
@ Roberthaenel - THANK'S! I have just seen your similar Extension:IconLink. Your own extension is great too, so currently I have no idea, which one I should finally use ( ; - ) ... because both extensions are great!
Thank's again! --80.109.228.11 00:08, 6 April 2008 (UTC)