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){
    LETT=DRIVE.substr(0,1);
    location="file://" + LETT + ":/PDF/" + PATH;

    }
     
    pmind, Feb 6, 2012
    #1
    1. Advertisements

  2. pmind

    Scott Sauyet Guest

    On Feb 6, 10:44 am, pmind <> wrote:
    > [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
     
    Scott Sauyet, Feb 6, 2012
    #2
    1. Advertisements

  3. pmind

    pmind Guest

    On Feb 6, 4:33 pm, Scott Sauyet <> wrote:
    > On Feb 6, 10:44 am, pmind <> wrote:
    >
    > > [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!
     
    pmind, Feb 7, 2012
    #3
  4. pmind

    Scott Sauyet Guest

    pmind wrote:
    > Scott Sauyet wrote:
    >> 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
     
    Scott Sauyet, Feb 7, 2012
    #4
    1. Advertisements

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.
Similar Threads
  1. Jon
    Replies:
    5
    Views:
    12,484
    Scott M.
    Jan 17, 2010
  2. mh
    Replies:
    4
    Views:
    1,006
    Wolfgang Strobl
    May 31, 2005
  3. Tom Anderson
    Replies:
    8
    Views:
    711
    Gerrit Holl
    Sep 15, 2005
  4. Mike Joyce
    Replies:
    3
    Views:
    3,542
    Gordon Rainsford
    May 3, 2006
  5. shailesh
    Replies:
    1
    Views:
    1,185
    Tim Golden
    Mar 28, 2007
  6. deliasmith

    C DRIVE AND D DRIVE

    deliasmith, May 16, 2008, in forum: ASP .Net
    Replies:
    16
    Views:
    3,205
  7. king
    Replies:
    1
    Views:
    560
Loading...