Favicon

S

shapper

Hello,

I am adding a Favicon as follows:
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

I supose this is correct. Do I need to place the favicon on the site's
root or can I place it on a images folder and change the href.? For
example:

<link rel="shortcut icon" href="images/favicon.ico" type="image/x-
icon" />

Thanks,
Miguel
 
R

Raymond SCHMIT

Hello,

I am adding a Favicon as follows:
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

I supose this is correct. Do I need to place the favicon on the site's
root or can I place it on a images folder and change the href.? For
example:

<link rel="shortcut icon" href="images/favicon.ico" type="image/x-
icon" />
The favicon href is related with root of the page we surf, not
necessary the root of the site.
Per example you may have index.html on the root of the site and the
differents pages on pages/welcome.htm.

if you put favicon there -> pages/images/favicon.ico
your href of the welcome.htm page will be = href="images/favicon.ico"

if you put favicon there -> pages/favicon.ico
your href of the welcome.htm page will be = href="favicon.ico"

if you put favicon there -> favicon.ico
your href of the welcome.htm page will be = href="../favicon.ico"

if you put favicon there -> images/favicon.ico
your href of the welcome.htm page will be =
href="../images/favicon.ico"

Someone may correct me if i have said something wrong.
This are simple example without speaking about the "base" - all infos
can be found there -> http://www.w3schools.com/TAGS/tag_base.asp
 
R

Roy A.

The favicon href is related with root of the page we surf, not
necessary the root of the site.

Yes, correct. But you can also use an 'absolute-path reference' by
adding an slash before the url:

href="/favicon.ico"

whould refer to favicon.ico file in the site root, e.g. 'example.com/
favicon.ico'

href="/images/favicon.ico"

would refere to the facicon.ico file in the images folder directly
under the site root, e.g. 'example.com/images/favicon.ico'

I.e. insted of 'href="http://www.example.com/images/favicon.ico' you
could use 'href="/images/favicon.ico"'.

"A relative reference that begins with a single slash character is
termed an absolute-path reference."
http://tools.ietf.org/html/rfc3986#section-4.2
Per example you may have index.html on the root of the site and the
differents pages on pages/welcome.htm.

if you put favicon there -> pages/images/favicon.ico
your href of the welcome.htm page will be = href="images/favicon.ico"

if you put favicon there -> pages/favicon.ico
your href of the welcome.htm page will be = href="favicon.ico"

if you put favicon there -> favicon.ico
your href of the welcome.htm page will be = href="../favicon.ico"

if you put favicon there -> images/favicon.ico
your href of the welcome.htm page will be =
href="../images/favicon.ico"

Someone may correct me if i have said something wrong.

That would be right, but I find it easyer to use a path relative to
the site root. Although, you would have to set up an web server to
make this work at your localhost.
This are simple example without speaking about the "base" - all infos
can be found there ->http://www.w3schools.com/TAGS/tag_base.asp

I wouldn't mess too much around with the base tag. It will give you
more trouble than it solves.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top