views:

54

answers:

2

HI, This makes no sense, but for example if i downloaded a file to your /Downloads folder and i wanted to run file:///.../Downloads/myfile1.txt i could just go:

window.location = "file:///.../Downloads/myfile1.txt;

But if i had say 10, or it was generated by a script.. how could i do effectively this.. open ...myfile1.txt => ...myfile1.txt I tried running a jquery .Each() statement with an array of file names.. but it only opens the first one.

window.open();

That would leave me with hundreds of open windows, which i dont want :/

BTW. I'm not doing the file:/// but its not a http:// its local URL Scheme :)

Thanks!!

+1  A: 

If what you're trying to do is open a series of URLs, one after another, in a single window, then I see a couple of options.

When you loop through the list, you could use window.open on each one, but give the window a name and use the same name for each -- that way it would open a single extra window and load each URL in it. Note that it might well start loading one before the previous one has had time to finish loading, unless you add a pause of some kind, or use a callback approach.

The second approach is to load them, one after another, into an iframe on your page. Same timing issues apply.

JacobM
make an iframe for each window.open in a hidden div, then remove it before the next one is made :D
tarnfeld
A: 

This is not going to work because every decent browser will block access to local documents, downloaded or not.

Pekka
well this will only work on a Mac anyway...
tarnfeld