Nik's Technology Blog

Travels through programming, networks, and computers

Google Reader 'Shared Items' Widget Broke My Site in IE7

As an avid user of Firefox the dangers of using one browser (apart from initial testing) became apparent today, especially considering most web users still use Internet Explorer.

I recently converted my site to use Blogger, and I also thought I'd share interesting news articles I read with my visitors by using Google Reader's Javascript widget.

Google Reader is still in Beta

I placed the Javascript widget on my home page and my blog pages a while back. I just checked my site in Internet Explorer 7 and was amazed to see only the template was rendered. There was a distinct lack of content!

I looked at the source HTML, and the content was there. I was puzzled for a few minutes until I realised what the blog page and the home page had in common; The Javascript Google widget.

I quickly removed them and FTPed the pages, the problem was resolved. I grabbed the URL the script block was trying to call and tried to download the external Javascript straight to my browser... it timed-out.

It appears that Internet Explorer will get stuck when external Javascript doesn't load, so be aware of this the next time you choose to use an externally hosted Javascript file. Opera and Firefox didn't seem to have a problem.

Website Spam Avoidance - Javascript Code

Use the following JavaScript if you want to display an email address on your website, but you don't want to receive spam mail. It will avoid getting picked up by Spammer's email collecting scripts.

<script language="JavaScript" type="text/javascript">

<!--

var LinkText = "click here";

var e1 = "mail";

var e2 = "to:";

var EmailPart1 = "yourname";

var EmailPart2 = "yourdomain";

var EmailPart3 = ".com";

document.write("<a h" + "ref=" + e1 + e2 + EmailPart1 + "@" + EmailPart2 + EmailPart3 + ">" + LinkText + "</a>")

//-->

</script>