While you wait for Ev.

While you wait for Ev. to support pinging weblogs.com, you can manually ping them, either by going to the ping site form page or by using Aaron’s bookmarklet or my popup version, but neither way is automagic enough to suit me.

What I’m doing, and what you can do too, is combining a cookie with the named window that opens when you click “view web page” from Blogger’s editing page (you need a cookie, since someone else could go to your page in the window where they viewed their own blog). It only works for publishes from Blogger (not from BlogThis, or blogBuddy, or bloggerbot), and only from a computer where you have set the cookie to identify you, but then, this is just a stopgap while we wait for Ev. To set it up, put the following script in your template (better yet, if you aren’t on Blog*Spot, save it as a .js and just include it with a script src= tag):

<script type="text/javascript">
var blogName = "Blogger+tech";
var blogURL = "http://bloggertech.blogspot.com";
var pingURL = "http://newhome.weblogs.com/pingSiteForm?name=" + blogName + "&url=" + escape( blogURL );
// Cookie functions shamelessly stolen from Andy at 
// weblog.cheesephone.co.uk/mytemplate.html
function Cookie_GetCookie(){
 var i = document.cookie.indexOf( this.CookieName + "=" );
 if ( -1 != i ){
  var e = document.cookie.slice( i ).indexOf( ";" );
  this.cookieVal = document.cookie.slice( i+this.CookieName.length+1, (-1 != e)?e:document.cookie.length );
  return this.cookieVal;
  }
 return null;
}
function Cookie_SetCookie( Value ){
 var expireDate = new Date(); 
 expireDate.setTime( expireDate.getTime() + this.expireTimeInMs );
 var cookietext = this.CookieName + "=" + Value + "; expires=" + expireDate.toGMTString()+"; path=/";
 document.cookie = cookietext;
 this.cookieVal = Value; 
}
function Cookie( theCookieName, theExpireTimeInDays ){
 this.CookieName = theCookieName;
 this.cookieVal = null;
 this.expireTimeInMs = theExpireTimeInDays * 100 * 60 * 60 * 24;
 // methods
 Cookie.prototype.GetCookie = Cookie_GetCookie;
 Cookie.prototype.SetCookie = Cookie_SetCookie;
}
if ( "BloggerView" == window.name ){
 var pingCookie = new Cookie( "Ping", 5000 );
 pingCookie.SetCookie( "yep" );
// if ( null != pingCookie.GetCookie() )
//  window.open( pingURL, "status", "scrollbars=no,width=600,height=400,left=75,top=100" );
}
</script>

Note the three vars at the top: blogName, blogURL, and pingURL. Unless you want to ping for my site, you will need to change blogName (replace spaces with +) and blogURL to match your site. pingURL you can leave as is (unless Dave changes it at some point). You now have the script ready to set a cookie for you. Notice that the two lines at the bottom which check for the cookie and do the actual ping are commented out. Save your template, publish, and “view web page”. You now have the cookie set. So will anyone who happens to view your site in a window named “BloggerView”, so don’t dawdle – go back to edit your template, and comment out (put // at the start of) the line that sets the cookie: pingCookie.SetCookie( “yep” );. Delete the comment slashes at the start of the next two lines, save your template, and publish. Now when you “view web page” you should see another window pop up, telling you that you have joined all the Manila and Movable Type users by telling weblogs.com that you’ve updated.

If you need to add a cookie to a different computer sometime later, just uncomment the pingCookie.SetCookie line long enough to add the cookie. If you are working on your template, publishing and viewing repeatedly without adding content, comment out the next two lines until you are done, so you won’t over-ping.

[Thanks to Andy for the stolen cookie code, and Dan Hartung, whose post to the weblogs.com Yahoo Group gave me the idea.]

2 Comments

Comment by Peter Scott #
2001-11-22 08:56:45

I have added a link to this blog on:
http://www.lights.com/weblogs/tools.html

 
Comment by kimmie #
2001-11-27 03:15:18

i cut and pasted exactly, and followed the directions to a t. it’s not setting the cookie. i don’t have anything blocking them, and i even set my security settings to prompt for cookies so i would be sure if it was setting it or not, and it is not. any suggestions?

 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <del datetime="" cite=""> <dd> <dl> <dt> <em> <i> <ins datetime="" cite=""> <kbd> <li> <ol> <p> <pre> <q cite=""> <samp> <strong> <sub> <sup> <ul> in your comment.