Base in HTML

Hi

Can we specify a folder path instead of a URL?

Can the following work?


<html>
<head>
<base href="/images" />                //or this should be "http://www.mydomain.com" only
</head>

<body>
<img src="house.jpg" alt="This is my house"/>

</body>
</html>
JRawabiAsked:
Who is Participating?
 
GaryConnect With a Mentor Commented:
You can but IE doesn't like it - which makes it pointless doing it that way.
0
 
Amar BardoliwalaCommented:
Hello jrawabt,

it should work.

Please look at following link to learn about absolute and relative paths.

http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm

http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/

Hope this will help you.

Thank you.

Amar Bardoliwala
0
 
Julian HansenCommented:
To clarify your question

Are you asking if the base ref can include a folder path or only a domain i.e. the following is valid

http://mydomain.com/images

If you mean just

/images

Then not sure what the objective is - you are trying to set a fixed base url to a relative path - why not just specify base ref as

http://mydomain.com/images

I think you need to maybe give more information on what you are trying to achieve.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
JRawabiAuthor Commented:
julianH

Thanks for the reply.

Just local folder like /images

I am trying to fix a path not a url. Is that possible?

Thanks
0
 
JRawabiAuthor Commented:
amar_bardoliwala

See my comment above. I want to use the base tag and use a local path not a url.

<base href="/images" />  not a domain name.
0
 
GaryCommented:
As I said, it will not work in IE - you have to use the full url.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.