Change Drive Location

Discussion in 'Javascript' started by pmind, Feb 6, 2012.

  1. pmind

    pmind Guest

    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){
    location="file://" + LETT + ":/PDF/" + PATH;

    pmind, Feb 6, 2012
    1. Advertisements

  2. pmind

    Scott Sauyet Guest

    Try generating


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

    -- Scott
    Scott Sauyet, Feb 6, 2012
    1. Advertisements

  3. pmind

    pmind Guest

    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!
    pmind, Feb 7, 2012
  4. pmind

    Scott Sauyet Guest

    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
    Scott Sauyet, Feb 7, 2012
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.