By using <base>
tag we can specify the base URL/target for all relative URL in a document. There can be maximum one <base>
tag in a document, and it must be inside the <head>
tag.
<head> <base href="http://www.dotnetfunda.com" /> </head> <body> <p> <a href="/abbr.htm">Abbreviation tag</a> </p> <p> <a href="/article.html">Article</a> </p> <p> <a href="/articles/show/3112/progressive-continuous-loading-using-jquery">Something is good</a> </p> <p> <a href="http://www.itfunda.com">ITFunda.com</a> </p> </body>
In the above code snippet we can notice that <base>
tag which represents the base URL (www.dotnetfunda.com) is placed inside the <head>
tag, and all the relative URL's is placed inside the <body>
tag by using <a>
tag.
When above code snippet runs in the browser, top 3 links target web pages on www.dotnetfunda.com as the path is relative and 4th link simply goes to itfunda.com as the href attributes set its path starting with "http://".
OUTPUT
Views: 5308 | Post Order: 64