Looking to determine the final URL of a known redirect

U

uttles

Hello all,

I'm new to Javascript, so be kind please.

I'm trying to use Digg's new site integration on my blogger blog, and I
have run into some issues.

Firstly, here's the script Digg offers:

<script>
digg_url = 'URLOFSTORY';
</script>
<script src="http://digg.com/api/diggthis.js"></script>

Not so obviously, URLOFSTORY is the url on Digg's site, not the link in
your own blog site. So you have to know the Digg url of your story
before you even write your story... sortof a paradox.

However, if you use digg's submit link to submit a story that has
already been entered, you are redirected to that story's page. In that
case, the URLOFSTORY is sitting right there after the redirect. The
problem is, how do I get that value?

So, here's the pseudocode of what I think I need:

Script in head:
finddiggurl(permalink){
somehowfindlink('http://www.digg.com/submit?phase=2&url=' &
permalink);
}
....

Code in body:
<script>
digg_url = 'finddiggurl(<$BlogItemPermalinkUrl$>';
</script>
<script src="http://digg.com/api/diggthis.js"></script>

I've been searching for some method of prefetching the final (after
redirect) url but I can't seem to find anything. Does anyone out there
have any ideas?

PS - I'd additionally like some logic to go into what is displayed in
the blog post.
IE:

If digg_url contains 'submit' then
display a generic "digg this" image
else
<script src="http://digg.com/api/diggthis.js"></script>
end

I have no idea how to do that either. Any help with any of this would
be great!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top