Change Drive Location

P

pmind

Hello all,

I have been asked to add the contents of a CD to a network location.
When installed on a PC, the installation software asks for the letter
of the local CD drive; this works without flaw. The CD basically
contains an HTML index page and a folder of PDF's. The index page uses
a javascript to call the basic location of the PDF folder. My question
is: how can I modify the following javascript to find a network
location instead of a local drive letter?
I've tried a few unsuccessful approaches using my very limited
knowledge of javascript. Any assistance would be greatly appreciated.
Thanks, Paul.

var DRIVE="E";

function GoPDF(PATH){
LETT=DRIVE.substr(0,1);
location="file://" + LETT + ":/PDF/" + PATH;

}
 
S

Scott Sauyet

[H]ow can I modify the following javascript to find a network
location instead of a local drive letter?
var DRIVE="E";

function GoPDF(PATH){
    LETT=DRIVE.substr(0,1);
    location="file://" + LETT + ":/PDF/" + PATH;
}

Try generating

file://///networkShareName/path/to/your.pdf

And yes, that's five forward slashes near the beginning. Don't
ask! :)

-- Scott
 
P

pmind

[H]ow can I modify the following javascript to find a network
location instead of a local drive letter?
var DRIVE="E";
function GoPDF(PATH){
    LETT=DRIVE.substr(0,1);
    location="file://" + LETT + ":/PDF/" + PATH;
}

Try generating

    file://///networkShareName/path/to/your.pdf

And yes, that's five forward slashes near the beginning.  Don't
ask!  :)

  -- Scott

Thanks Scott, I got it now. I just removed the variable and simplified
the code, like so:

function GoPDF(PATH) {
location= "file://" + "networkShareName/path/to/your/pdf" + "/
PDF/" + PATH;

}

Thanks again!
 
S

Scott Sauyet

pmind said:
Scott said:
pmind wrote:
[H]ow can I modify the following javascript to find a network
location instead of a local drive letter? [ ... ]
Try generating
    file://///networkShareName/path/to/your.pdf
And yes, that's five forward slashes near the beginning.  Don't
ask!  :)

Thanks Scott, I got it now. I just removed the variable and simplified
the code, like so:

function GoPDF(PATH) {
     location= "file://" + "networkShareName/path/to/your/pdf" + "/
PDF/" + PATH;
  }

You might still want the five slashes in there. I think two will work
for IE and Chrome, but will fail for Firefox. (I can't remember about
Opera or Safari, and don't have them available at the moment.) Five
will work everywhere.

-- Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top