Disons que je suis actuellement à: http://example.com/folder/page.html
Est-il possible de créer un lien relatif sur cette page qui pointe vers http://example.com/folder/
sans spécifier de folder
où que ce soit? (Et en utilisant uniquement le HTML.)
UPDATE: Comme il s’est avéré ./
ne fonctionne qu’en mode doctype non ssortingct, alors que .
fonctionne dans les deux modes, donc c’est toujours une meilleure réponse à mon avis 🙂 Merci à tous.
Just dot fonctionnehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. Le doctype fait la différence, car parfois, le https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./ convient égalementhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
Link to this folder
Pour quiconque a trouvé ce thread, le traitement des chemins relatifs a toujours créé des arguments sur ce qui est correct ou nonhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
Selon l’endroit où vous utilisez le chemin à traiter, cela dépendra de la manière dont vous aborderez le cheminhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
Généralement :
https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
et https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./
faites la même chose, mais vous ne l’utiliseriez pas https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
avec un nom de fichierhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. Sinon, le navigateur demandera le nom de fichier https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.filenamehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.ext
tant que fichier du serveurhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. La méthode appropriée serait https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./filenamehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.ext
https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./
adresse le chemin d’access au niveau supérieur du dossier actuelhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. Si vous étiez dans le chemin /cheese/crackers/yummyhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html
et que votre code de lien demandait https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./butter/spreadhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html
dans le document yummyhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html
, vous vous adresseriez au chemin /cheese/butter/spreadhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html
, en ce qui concerne le serveurhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
/
adressera toujours la racine du sitehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
Page Folder directory
Vous pouvez utiliser
https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./
signifier jusqu’à un niveauhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. Si vous avez une page appelée page2https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html dans le même dossier que pagehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html, le chemin relatif est le suivant:
page2https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.htmlhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
Si vous avez page2https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html au même niveau que le dossier, le chemin est le suivant:
https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./page2https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html
Les deux ci-dessous semblent fonctionner
https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./
https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.
La première réponse n’est pas assez clairehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. Voici ce qui a fonctionné pour moi: Le format correct devrait ressembler à ceci si vous voulez pointer vers le fichier actuel:
Cela vous permettra de pointer vers ce fichier dans le même dossier si vous êtes sur la page http://examplehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.com/folder/indexhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html