SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast welded's Avatar
    Join Date
    Jun 2001
    Location
    vancouver.bc.ca
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript: the poor man's php?

    boy, i hope so.
    here's the situation. i want to be able to make a page that, depending on the link, will download a certain file. i'm sure you know what i mean.

    say i have a link like this:
    http://www.url.com/download.html?file.zip

    i can do this with cgi, i could do this with php if i knew it, but i HAVE to do it with javascript. i don't know much javascript at all, so any attempts to write or modify similar code is all but fruitless. the exact scenario i am going for is a user gets their weekly email from this site, and it contains links to some files. just simple stuff, like wallpaper, etc. i don't want to have to edit a download page everytime this email goes out, i want the link to dynamically add file.zip to a meta refresh tag and to an anchor tag on this page.

    see what i'm saying?
    what i need is the way to do this. i'll live without it, but i'd really like to know.

    i really appreciate any help you folks can give.
    it's amazing what velocity can do
    when human beings are in season

  2. #2
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do you HAVE to do it with JavaScript?
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com

  3. #3
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm guessing you mean something like this:
    Code:
    <html>
    <head>
    <script>
    <!--
    file = document.location.search;
    file = file.substring(1,file.length);
    document.writeln('<meta http-equiv="refresh" content="5; URL='+ file +'">');
    //-->
    </script>
    </head>
    <body>
    <script>
    <!--
    document.write('If the download does not start in 5 seconds, click ');
    document.write('<a href="'+ file +'">here</a>');
    document.write(' to start the download.');
    //-->
    </script>
    
    </body>
    </html>

  4. #4
    SitePoint Enthusiast welded's Avatar
    Join Date
    Jun 2001
    Location
    vancouver.bc.ca
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oooh, you make me want to make hot sweet love to you! thank you so much, you've been a great help!
    see, i knew how i wanted it done, but i just don't know enough javascript to follow through.

    i had to do it in javascript because the project i'm working on now is just a favour for somebody and they are running their site on angelfire which as i'm sure you know, sucks like a hoover in a blackhole. i'm running some cgi elements off of my site, but i didn't want her site anchored to mine more than i needed to, so this, really, is the best choice.

    once again, thank you very much.
    it's amazing what velocity can do
    when human beings are in season

  5. #5
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *coughs* no problem =)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •