How to add a base URL for all the links in a page in HTML?

HTMLJavascriptProgramming Scripts

To add a base URL, use the <base> tag in HTML. For example, you can set the base URL once at the top of your page in the header section, then all subsequent relative links will use that URL as a starting point.

Example

You can try to run the following code to learn how to add a base URL for all the links in a page in HTML −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML base Tag</title>
      <base href = "https://www.qries.com" />
   </head>
   <body>
      Qries.com <img src = "/images/banner_logo.png" />
   </body>
</html>
raja
Published on 13-Mar-2018 06:17:21
Advertisements