Results 1 to 5 of 5

Thread: Open a folder with a link

  1. #1

    Thread Starter
    Hyperactive Member xxarmoxx's Avatar
    Join Date
    Mar 2007
    Posts
    378

    Open a folder with a link

    I have a link like so

    Code:
    file:///Volumes/folder/name/
    Is there anyway with javascript to make this folder open when the link is clicked?

    I already tried the window.open function, but its not working.

    Thanks.

  2. #2
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: Open a folder with a link

    Please don't cross-post. If you don't know whether to post in PHP or HTML, take your best guess and post in one section.

    Anyway, you do this the same as any other link, but you need to specify a complete path beginning with the drive letter:
    Code:
    <a href="file:///C:\Volumes\folder\name\">Click here.</a>
    And of course it won't work if that exact folder doesn't exist.
    Last edited by SambaNeko; Jan 29th, 2010 at 04:32 PM.

  3. #3

    Thread Starter
    Hyperactive Member xxarmoxx's Avatar
    Join Date
    Mar 2007
    Posts
    378

    Re: Open a folder with a link

    Sorry for the cross-post.

    This doesn't work:
    Code:
    <a href="file:///C:\Volumes\folder\name\">Click here.</a>
    Is it possible that its a security issue which is being blocked by the browser?

  4. #4
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: Open a folder with a link

    Quite probably, yes. The link works for me when used from a local page, but when uploaded to a remote domain, no longer works.

    Edit: some Googling suggests that some OS/browser combinations have no trouble opening these types of links (from a remote site), but more modern configurations don't allow them (one person said it worked when they added their domain to "Trusted Sites" in IE). This makes sense to me, as linking to a local drive doesn't really make sense on a hosted web page anyway.
    Last edited by SambaNeko; Jan 29th, 2010 at 04:49 PM.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Open a folder with a link

    file URLs will only be resolved from pages served from file

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width