Yeah, I was trying to figure out a way to do that as well. Wasn't familiar with the "lastIndexOf()". That is similar to another one I'm looking at, AnandTech. The Story ID is the last number of the URI, but it isn't right after the last /. Can I use another char maybe, like the "?"
So the story URI is:
http://www.anandtech.com/cpuchipsets...oc.aspx?i=2598
and to grab the last "i=2598" to turn it into:
http://www.anandtech.com/printarticle.aspx?i=2598
should be something like this?:
document.onanchorlink = function(link) {
link.referrer = link.uri;
var filename = link.uri.substring(link.uri.lastIndexOf('?'));
link.uri = "http://www.anandtech.com/printarticle.aspx?" + filename;
};
Or am I not grasping the concept of this lastIndexOf call?