what is the difference between the absolute and relative links? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

what is the difference between the absolute and relative links?

25th Dec 2016, 7:21 AM
Chahat Gupta
Chahat Gupta - avatar
2 Antworten
+ 7
• Absolute links/paths are STATIC (thus usually long) and ALWAYS include the base domain name of the website. You must always use them when linking to a location from another website, but you can also use them within your own. http://www.mysite.com http://www.mysite.com/images http://www.mysite.com/folder/list.txt http://www.externalsite.com • Relative paths merely POINT to another file/path within YOUR website. These are RECOMMENDED as they remain valid in case you need to change your domain in the future. list.txt (1) images/graph.jpg (2) ../folders/files/solo.txt (3) These link to: (1) a .txt file in the SAME directory (2) an image inside the images folder in the SAME directory (3) a .txt file located in folders/files in the PARENT directory (notated by ../) They are all relative to their HTML document's location.
25th Dec 2016, 8:22 AM
Hyper Late Night Code
Hyper Late Night Code - avatar
+ 3
Relative link is built like "current/path/of/file/" + "your/link" 1st part is path to folder where your html file is stored 2nd part is your link Abdolute link contains both parts
25th Dec 2016, 7:39 AM
Vladislav
Vladislav - avatar