Hi,
To display image in title bar and address bar , i have tried in all possible ways but image is not reflecting on the title bar and address bar. I have done as below:
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
I have created a .ico file and tried even that is not working.Please let me know where iam going wrong?

Thanks.

Dani AI

Generated

Common causes when a favicon doesn't appear: wrong file path or case, browser caching, the server returning HTML (redirect/login) instead of the image, incorrect MIME type, the link tag placed outside the document head, or an unsupported image variant for the browser. has already tried a .ico; 's suggestion to check the full URL and 's note about a modern doctype are sensible starting points. The items below fill gaps not covered in earlier replies.

Useful diagnostics

  • Verify the icon URL opens directly in a browser and returns a valid image rather than an HTML page (many apps redirect favicon requests to a login page).
  • Check headers with a quick request tool to confirm HTTP status and Content-Type. For example:
curl -I https://example.com/path/to/favicon.ico

Look for a 200 response and a Content-Type like image/x-icon or image/png in DevTools > Network. If the response is 301/302 or 200 with text/html, fix server rules so the static file is served directly.

Common fixes and gotchas

  • File and folder name case matters on Linux servers (Images vs images).
  • Place the link element inside the HTML <head> (not the HTML5 <header> element).
  • Put a fallback at the site root as /favicon.ico because browsers will probe that path automatically.
  • Ensure any auth/URL-rewrite filters exclude favicon requests so they are not intercepted.
  • Browsers cache favicons aggressively—test in an incognito window or force reload, and restart the browser if needed.

Cross-browser compatibility
Provide a small set of formats so legacy and modern browsers are covered (multi-size ICO, PNG, apple-touch icon). Example link patterns:

<link rel="icon" href="/favicon-32.png" sizes="32x32" type="image/png">
<link rel="icon" href="/favicon.ico" sizes="16x16 32x32" type="image/x-icon">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">

Checklist summary: open the icon URL, confirm 200 + correct MIME, check for redirects or authentication, correct path/case, ensure link is inside <head>, clear the browser cache, and provide multi-format icons.

Recommended Answers

All 5 Replies

Member Avatar for Member #949455

image in title bar and address bar

I don't understand what you are doing?

You just want the icon appear on top right?

You should put it in between <header> tags

<link rel="shortcut icon" href="images/favicon.ico"">

:( i have done the same but the image is not reflecting in the title bar (top). I have done in the following way:
<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<link rel="shortcut icon" type="image/x-icon" href="/Images/favicon.ico" />
<title>Welcome</title>
<link rel="stylesheet" href="style/pageStyleSheet.css" type="text/css"/>
</head>

<body>

<div class="container">
....
Where iam going wrong.
Thanks for your time.

I use the full url, as in where you just have images/favicon.ico

Member Avatar for Member #949455

You should be using HTML5:

<!DOCTYPE html>

and regarding about the icon appear try drjohn suggestion

From this:

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

to this:

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

Hi
Thanks for the time.
I have tried in all possible ways before only. I even tried by given the entire path of the favicon.ico file but image is not reflecting in the title bar. I even tried creating the favicon.ico file by following the steps given to create a favicon.ico file, but no luck.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.