Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML base tag equivalent for absolute path

Tags:

html

path

Imagine a website located at http://example.com/myWebsite/.

I would like my absolute paths to point to myWebsite directory.

I know one can do it for relative links with the base tag, but I wish to keep the default behavior for relative links.

Is there something useful I can specify in head ?

like image 474
Apolo Avatar asked Jul 04 '26 03:07

Apolo


1 Answers

<!DOCTYPE html>
<html>
<head>
<base href="http://example.com/myWebsite/" target="_blank">
</head>
<body>

<p><img src="stickman.gif" width="24" height="39" alt="Stickman"> - 
Notice that we have only specified a relative address for the image. 
Since we have specified a base URL in the head section, the browser will 
look for the image at "http://example.com/myWebsite/stickman.gif".
</p>

</body>
</html>

Use this

like image 188
Waqas Ali Avatar answered Jul 06 '26 16:07

Waqas Ali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!