To create a link to a file or folder, you need to use an <a href > tag. HTML can be used to open a folder from our local storage. To open a folder from our local storage, use the ‘href‘ attribute of HTML. In the href attribute, we specify the path of our folder.
Syntax:
<a href="Path"></a>
Examples to open local folders using HTML
Example 1: Implementation to show how to make an HTML link to open a folder.
html
<!DOCTYPE html> < html >
< head >
< title >HTML link to open a folder</ title >
</ head >
< body >
< h1 >Opening a folder from HTML code</ h1 >
< a href = "D:\Gif" >
Click to open a folder
</ a >
</ body >
</ html >
|
Output:
Example 2: Implementation to show how to make an HTML link to open a folder.
html
<!DOCTYPE html> < html >
< head >
< title >Sample Code</ title >
</ head >
< body >
< h1 >Opening a folder from HTML code</ h1 >
< a href = "C:\Users\ABC\Desktop\cpp" >
Click to open a folder
</ a >
</ body >
</ html >
|
Output: