Reputation: 841
I am working on a Drupal site with some PDF files where I am opening a PDF file in a new window. The files are getting opened in the browser with the Acrobat Reader plugin but the favicon is not getting displayed. What should be done to show the favicon?
Upvotes: 20
Views: 37104
Reputation: 449555
If you show the PDF file in an iframe
, the browser should show the site-wide favicon, but you're out of luck in an external applications. Acrobat Reader doesn't use Favicons.
UPDATE This is now possible by placing favicon.ico in the root directory of your website as per @s1m0n1stv4n answer below
Upvotes: 10
Reputation: 351
If you put a favicon.ico
to the root of your site, then your PDFs opened on that site will actually have that favicon. You can generate transparent ICOs from PNGs with online favicon genereators.
For example, if your favicon is reachable in:
http://example.com/favicon.ico
Then your PDF will show this favicon in the Acrobat plugin tab:
http://example.com/something/something.pdf
Upvotes: 35
Reputation: 19
In the Drupal root directory, edit the .htaccess file and add this:
RewriteRule ^favicon.ico sites/%{SERVER_NAME}/favicon.ico [NC,L]
Exactly as it is typed there, and right after the RewriteBase line near the bottom.
See caveats here: http://drupal.org/node/174940#comment-852888
This assumes you have friendly URLs working in Drupal, or the RewriteRule will be useless.
In each sites/example.com/ directory, add the favicon.ico for that site.
Jump through hoops to clear your favicon cache in your browser / OS: http://www.faviconblog.com/clear-the-browser-cache-to-display-your-favicon/
This MAY over-ride the HTML HEAD favicon that Drupal spits out when you upload one in some browsers, or not. Haven't tested. If it does, you'll have to have a favicon.ico for every sites/XYZ/
Note that just because uploaded HEAD favicon overrides the sites/XYZ/ in one browser, is no indication it will work in another, or vice versa.
Upvotes: 0
Reputation: 575
Displaying the PDF from <iframe>
, <object>
, or maybe even <embed>
tag inside of an HTML page should result in the favicon being used.
Upvotes: -3