Opening the Flickr Zoom Badge in a New Window
The Flickr Javascript badge has been driving me crazy. It has all these great variable inputs, but no “target” variable. The last thing I want is a user to click an image, and it go off to Flickr, leaving my site completely. I’ve been looking all over for a solution for this, and was on the verge of writing one, when I stumbled across a great blog post about how to fix this.
I needed this to work in the Flickr Zoom Badge plugin for WordPress, so here’s a quick how to:
Find the end of the “flickr_badge_wrapper” div in the flickr-zoom-badge.php file in “wp-content/plugins/flickr-zoom-badge”. For my version, this was line 150. Then just paste in the following code:
<script>
<!–
var oFlickrTable = document.getElementById(“flickr_badge_wrapper”);
oFlickrBadgePhotos = oFlickrTable.getElementsByTagName(“a”);
for (nBadgePhoto = 0; nBadgePhoto < oFlickrBadgePhotos.length; nBadgePhoto++) {
oFlickrBadgePhotos[nBadgePhoto].target = “_blank”;
}
//–>
</script>
