Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

X1Lightning

macrumors 6502
Original poster
Feb 19, 2007
413
0
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?
 
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.
 
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
 
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>
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.