WordPress.org

Ready to get started?Download WordPress

Forums

Redirections Help (3 posts)

  1. iebtech
    Member
    Posted 2 years ago #

    Hi, I would like the downloads on my website, to when clicked, all go to one page, and after let's say 30 seconds it redirects to the download link. I think you can do this with URL Parameters, but I have no idea how to use them. Any help is greatly appreciated. Thanks!

  2. Well, you can do it with javascript.

    The idea is that you will make your link.. and then use javascript to delay the link for 30 seconds.

    You will need the "Scripts and Styles" plugin first. Search for it in the repository here.

    Then, in your global "scripts" section, add this:

    document.write('<style type="text/css">#timed{display:none;}<\/style>')
     function delay_link(){
     var d=delay_link, t=document.getElementById('timed');
     if(d.c&&d.c.nodeValue.replace(/[^\d]*/,'')-1>0){
     d.c.nodeValue='\xa0\xa0'+(d.c.nodeValue.replace(/[^\d]*/,'')-1);
     setTimeout('delay_link()', 1000)
     return;
     }
     else if(!d.c){
     d.c=document.createTextNode('10');
     t.parentNode.insertBefore(d.c,t);
     setTimeout('delay_link()', 1000)
     return;
     }
     d.c.nodeValue='';
     t.style.display='inline';
     }

    Next, you will need to wrap whatever content you are delaying with a div with an id of timed. So, whenever you use anything with an id of timed, this effect will be applied.

    So, your html should look like this:

    <a id="timed" href='PATH_TO_YOUR_FILE'>Click Here to start your download</a>

    You can also add your own class to the link "a" tag above, if you wish to further style it via custom css:

    <a id="timed" class="my_style" href='PATH_TO_YOUR_FILE'>Click Here to start your download</a>

    Hope this helps get you started.

  3. iebtech
    Member
    Posted 2 years ago #

    Thanks you very much! This is increadibly helpful! One other quick question, by any chance would you know how lets say for example the download link is ?urlparam=DOWNLOADLINK (eg. ?urlparam=http://sites.google.com/a/iphone-dev.com/files/home/redsn0w_mac_0.9.13dev3.zip?attredirects=0&d=1) and with using that code it automaticly goes to that link after it redirects, so I don't have to make a page for each link? Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic