How to link a computer file in my html?

Asked

Viewed 2,256 times

0

How do I link a folder from my computer to my html file? Each folder I want to open is inside the same folder where I saved my html file.

I’ll leave the screen print to help you understand. Inside the pm-projects folder are the pm-project001, pm-project002 and pm-project003 folders; these are the folders I want to open in my html file, which tbm is saved in the pm-projects folder.

I inserted in the href of my html file the path of the folders I want to appear in my list, but when clicking on the links I get the answer "Cannot GET /Users/Isadora/Documents/Desenvolvimentoweb/pm-projects/pm-proj001".

<!DOCTYPE html>
<html lang="pt-br">
<head>

 <meta charset="utf-8"> 
 <title>Projetos</title>
 
</head>

<body>
   
    <ul>
        <li class="feito"><a href="C:Users/Isadora/Documents/DesenvolvimentoWeb/pm-projetos/pm-proj001">Projeto 001</a></li>
        <li class="feito"><a href="C:Users/Isadora/Documents/DesenvolvimentoWeb/pm-projetos/pm-proj002">Projeto 002</a></li>
        <li class="feito"><a href="C:Users/Isadora/Documents/DesenvolvimentoWeb/pm-projetos/pm-proj003">Projeto 003</a></li>

    </ul>
    
</body>
</html>
    

  • Is your file online or on your computer? What will call others by the link.

  • I will vote to close for lack of clarity. Where is the page? Local or online? Is it in the same folder you want to open? If it is local, it should have a file at the end of the link C:Users/Isadora/Documents/DesenvolvimentoWeb/projeto001/pagina.html or you want to open the whole folder?

  • What is the purpose of the link, you want to fetch files of what type, is a local project or goes to the server? More details that make it easier to give you an accurate answer.

  • The file is on my computer, dvd and hugocsl. It’s in the same folder that I want to open. I want to open each of these folders in the links. Are folders with html and css files.

  • 1

    So your problem is not in the question. You could edit it and explain better what’s going on or include more code. When we click on a link, something happens, it can be error, page not found etc... but something happens, it happens.

  • When clicking the link you should open the folder in the browser.

  • If you want to open the index, you have to put at the end of the link "index.html" ...

  • dvd , even when I put index.html at the end it returns the same answer "Cannot GET /Users/Isadora/Documents/Developmentoweb/pm-projects/pm-proj001/indx.html" .

  • 1

    But by the image you posted, still has a folder "Libraries" that is not in the link

  • Before "Documents"

  • 1

    Libraries is not a folder, it is a Windows 7 resource that groups folders into Libraries/Libraries. Not matching the canonical path, @dvd.

  • @rodorgas td well, not be the case.

Show 7 more comments

1 answer

1


In your case, the most appropriate would be to use virtual paths as in the example below. So even if you are accessing your projects via file system or if you create a local hosting for the site DesenvolvimentoWeb, will maintain the same functionality.

And avoid pointing the link only to a directory if there is no server to respond to the request, it will display a behavior in each browser, OS and version, depending even on which directory you are saving your files. Without a server you will not open the index or default of that directory. Either list the files in the browser or will open the directory in the OS explorer or will do nothing or return an error.

<!DOCTYPE html>
<html lang="pt-br">
<head>

 <meta charset="utf-8"> 
 <title>Projetos</title>
 
</head>

<body>
   
    <ul>
        <li class="feito"><a href="../pm-proj001/index.html">Projeto 001</a></li>
        <li class="feito"><a href="../pm-proj002/index.html">Projeto 002</a></li>
        <li class="feito"><a href="../pm-proj003/index.html">Projeto 003</a></li>

    </ul>
    
</body>
</html>
    

Browser other questions tagged

You are not signed in. Login or sign up in order to post.