How to make an HTML link to open a folder?
HTML can be used to open a folder from our local storage. In order to open a folder from our local storage, use ‘HREF’ attribute of HTML. In the HREF attribute, we specify the path of our folder.
Syntax:
<a href="Path"></a>
Example 1:
<!DOCTYPE html> < html > < head > < title >Sample Code</ title > </ head > < body > < h1 >Opening a folder from HTML code</ h1 > < a href = "D:\Series\Breaking Bad" >Click to open a folder</ a > </ body > </ html > |
Output:
On clicking the link:
Example 2:
<!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:
On clicking the link: