June 16, 2012

Problematic Yahoo Pingbox [Solved]


A friend of mine was having problems with her Yahoo! Messenger Pingbox since it's Flash(swf) file only loads if the user has visited other yahoo! sites. Yahoo! failed on this one by requiring a cookie that is not guaranteed to be there.

Looking around the interwebz, I found a couple of suggestions, but the best one only worked after loading the page again. This solution requires jQuery to be included. Using some jQuery fu, I cooked up some code to:

1. Load yahoo! terms page in an iFrame. This will load the cookie that pingbox requires.
2. After that page completes, writes the Pingbox code.

<script type="text/javascript">
   $(document.body).append('<iframe id="myId" style="visiblity:hidden;display:none;" src="http://info.yahoo.com/legal/us/yahoo/"></iframe>');
   $('iframe#myId').load(function(){
      $('#pingboxhere').append('<object data="http://wgweb.msg.yahoo.com/badge/Pingbox.swf" height="420" id="ZZZZZZZ" type="application/x-shockwave-flash" width="240"><param name="movie" value="http://wgweb.msg.yahoo.com/badge/Pingbox.swf" /><param name="allowScriptAccess" value="always" /><param name="flashvars" value="YYYYYYY" /></object>');
   });
</script>
<div id="pingboxhere"></div>

I'm not sure if this solution is the best practice, but it works for me. Any thoughts?

1 comment:

Anonymous said...

My webpage doesn't allow iframe. Is there an alternative? I know some html, but not enough to solve this problem. Thanks.