Home  >  Article  >  Web Front-end  >  How to Open Local Folders Using Links?

How to Open Local Folders Using Links?

Susan Sarandon
Susan SarandonOriginal
2024-10-22 14:32:03744browse

How to Open Local Folders Using Links?

Opening Local Folders via Links

Many attempts have been made to open local folders via links, such as:

However, none of these options has proven successful across all browsers.

Solution: Launching a Downloadable Link

To bypass security restrictions and enable cross-browser compatibility, a downloadable link approach is recommended. Specifically, we can create a .URL or .LNK file and provide a link to it.

.URL File (Recommended):

  1. Ensure that .URL is added as an acceptable MIME type in your web server.
  2. Create a .URL file with the following format:
[InternetShortcut]
URL=file:///D:/
  1. Link to the .URL file from your HTML:
<code class="html"><a href="URIShortcut.url">Round-About Linking</a></code>

Browser-Dependent Behavior:

  • Chrome: Downloads the .URL file and opens it.
  • Firefox: Downloads the .URL file and opens it.
  • Internet Explorer: Opens the directory directly (no need to save the shortcut).

The above is the detailed content of How to Open Local Folders Using Links?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn