download 2 .doc files from one hyper link?

Discussion in 'Web Design and Development' started by X1Lightning, Jul 15, 2009.

  1. X1Lightning macrumors 6502

    X1Lightning

    Joined:
    Feb 19, 2007
    #1
    I have a weird request here, i have someone that wants 2 word doc files to be opened when they click on one hyper link, and they dont want the files zipped up into one.

    this is what i came up with.... the links are not real in this example
    but it works on some systems and not on others... basically it comes down to if they have a doc viewer or not. with out a doc viewer the browser opens 2 windows and downloads both of them with the browser it opens 2 windows and then chokes when the doc view opens......



    HTML:
    <a href="javascript: x=window.open('http://www.mydomain.com/documents/word1.doc', 'open_window1', 'menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0'); y=window.open('http://www.mydomain.com/documents/word2.doc', 'open_window2', 'menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0');">open documents</a>



    so does anyone have any bright ideas?
     
  2. OutThere macrumors 603

    OutThere

    Joined:
    Dec 19, 2002
    Location:
    NYC
    #2
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    I helped someone on here with this, but it was even more complicated as it involved the user picking some options before downloading all files associated with their options. It involved JavaScript and one iframe. Very similar to the above solution. If you only need to handle 2 specific files, then the above post will be one of the easiest options.
     
  4. X1Lightning thread starter macrumors 6502

    X1Lightning

    Joined:
    Feb 19, 2007
    #4
    the Iframe thing is interesting, the only problem i have is i'm embedding this in a crappy CMS that user already has. so i only have one page i can work with.
    but i think if i make two hidden Iframes and leave the source to blank until the link is clicked then have JS change the source on the Iframes to the docs i want to download.

    i'm going to give that a shot, thanks for the ideas
     
  5. X1Lightning thread starter macrumors 6502

    X1Lightning

    Joined:
    Feb 19, 2007
    #5
    For anyone who cares this is what i ended up doing

    <a href="javascript:
    (function()
    {
    var fr1 = document.getElementById ('iframe1');
    fr1.src='http://www.mydomain.com/documents/word1.doc';
    var fr2 = document.getElementById ('iframe2');
    fr2.src='http://www.mydomain.com/documents/word2.doc';
    })();
    ">
    West Virginia (2 DOCs)</a>
    <div id="diver" style="visibility:hidden; position:absolute; top:1; left:1">
    <iframe width="500" src="" id="iframe1" ></iframe>
    <br>
    <iframe width="500" src="" id="iframe2"></iframe>
    </div>
     
  6. TodVader macrumors 6502a

    TodVader

    Joined:
    Sep 27, 2005
    Location:
    Quebec, Canada
    #6
    The iframe can be made invisible with CSS but still do its thing: style="display:none;" just load it anywhere you want it.

    edit: Sorry, replied without reading the last posts.
     

Share This Page