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

How to Open Local Folders Using Links?

Susan Sarandon
Release: 2024-10-22 14:32:03
Original
845 people have browsed it

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:/
Copy after login
  1. Link to the .URL file from your HTML:
<code class="html"><a href="URIShortcut.url">Round-About Linking</a></code>
Copy after login

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!

source:php
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template