2

I have searched a lot about this issue, but all solutions in Google forum and here won't fix it, probably because they related to older Play version.

No matter how I modify the link tag

<link rel="Shortcut Icon" href='@routes.Assets.at("images/favicon.ico")' >

or modify route as suggested in other solutions, I always get the default green triangle icon shown in the browser. I even removed this icon but it's still displayed. Browser cache is cleared, I don't know what else I can do. Any help would be great.

boreas
  • 1,041
  • 1
  • 15
  • 30
  • Before trying all solutions, try to eliminate some before... When you browse the source code of you page in the browser and clicks on the `href` of your `link` tag, which picture is displayed ? If it is yours, then your routes are fine. What about writing `shortcut icon` ? – c4k Jan 02 '17 at 08:24
  • what version of play framework do you use? – Dmytro Pastovenskyi Jan 02 '17 at 09:50
  • 1
    It's not the play problem. You run into typical favicon cache problem. There is a lot of questions and solutions depends on OS and browser, like http://stackoverflow.com/questions/2208933/how-do-i-force-a-favicon-refresh, http://stackoverflow.com/questions/8616016/favicon-not-displayed-by-firefox-i-know-its-been-asked-10000-times – Andriy Kuba Jan 02 '17 at 17:12

1 Answers1

8

Change routes to:

GET     /favicon.ico    controllers.Assets.at(path="/public/images", file="yourimage.png")

Every browser is trying to get favicon by requesting it via /favicon.ico, so you can point it to your page there.

You can request/check your favicon doing this:

http://127.0.0.1:9000/favicon.ico

So if that works (request above) it means that it is most likely cache issue.

You can also read about how to use Assets on here: The Assets controller

I guess you are using OSX with Chrome and if so you need to clear favicon's cache. Please try next steps:

/Users/you/Library/Application Support/Google/Chrome/Default/Favcions

Restart your Chrome (in case if that does not help, try to delete journal as well and restart Chrome again).

/Users/you/Library/Application Support/Google/Chrome/Default/Favcions-journal

If you use another OS, I'm sure you will find in the google how to clear cache of favicons.

Dmytro Pastovenskyi
  • 5,240
  • 5
  • 37
  • 56