Display favicon for PDF files - html

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?

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

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

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.

Displaying the PDF from <iframe>, <object>, or maybe even <embed> tag inside of an HTML page should result in the favicon being used.

Related

How to set the favicon when viewing source in Chrome?

I have a page that displays the incorrect favicon when I view its source.
In the following image, you can see in the first tab (which is viewing the page) using the correct favicon - favicon-tenaya.ico.
However, when you go to view the page's source via Ctrl + U, it seems to display the default favicon - favico.ico, which is in the website's root folder:
Is there a way to get around this? We don't want the favicon changing when they view the source. How does the view source page in Chrome decide which favicon to use?
Viewing the source of a page is browser-dependent. There nothing you can do to force it to display a specific icon. For example, Firefox doesn't display any icon at all for a "View source" tab.
However, you can influence browsers to achieve this. For Chrome and your particular web site, replace the existing favicon.ico at the root of your web site with your favicon. This is what Chrome displays and yours is the black and white icon you don't want. Even better: rename favicon-tenaya.ico to favicon.ico (thus replacing the existing favicon.ico) and change the HTML accordingly.
As an aside, you don't need two declarations. Just keep the shortcut icon one, although the other one should do just as well.
Since Chrome does not parse the html it uses default file "/images/favicon.ico" to show as favicon in view-source. If it doesnt find it it look into different other locations too. for example if you use wordpress it uses http://[domain]/wp-content/themes/[theme]/images/favicon.ico
In Website, you can mention the favicon like below
<link rel="shortcut icon" href="/favicon-tenaya.ico"/>
and its working fine.
Where as in view source of chrome, they automattically find the favicon on below path
https://www.tenayalodge.com/favicon.ico
Favicon to be fetched from added favicon.ico after your website.
A very simple way:
put your favicon.ico file on the root of the website.
That should be accessed like: http://www.[domain].com/favicon.ico

Joomla 3.3 anchor does not download a uploaded pdf

I my joomla website I have a anchor that points to a uploaded pdf like this
STUFF
When I click it, the file does not download. However, if I "copy link address" and paste it in the address bar, it already works.
What is the cause of this? Some joomla limitation?
The way a link to a PDF is handled is often determined by the browser and the presence of plugins for PDF's. Most browsers handle them inline, i.e. they display them in the page.
Given that you're already using the HTML5 download attribute, it may be that your webpage or browser are the issue or the server configuration. Also wiht the combinations of browsers, plugins etc you may not be able to guarentee the same result across all users.
Things you can try, include:
Setting a target="_blank" on the <a href> tag (not strictly necessary but it will stop the user from leaving the page).
setting various headers on the PDF files (e.g. via .htaccess if you're using Apache)
For example you could add this to your .htaccess
<FilesMatch "\.pdf$">
AddType application/octet-stream .pdf
Header set Content-Disposition attachment
</FilesMatch>

Why does Chrome request resources that are not part of my site?

My site has like 5 files:
index.htm
favicon.ico
picture 1
picture 2
cache.mf
but I include links (in comments and js) to other sites. When I initially load my page chrome scrapes through all of those links. I don't want it to do that.
It is Google. It probably can't restrain to crawl the web... You probably can't do anything.
Well, you can of course - it is open source. Change it accordingly and recompile.

Favicon for static HTML page

I'm trying to upload a simple favicon to my HTML page. I've been browsing the web for answers and I'm being told to "upload the image to my server." My files are uploaded to GoDaddy, and I'm not exactly sure how to do this. Basically, how do I get my website to have the /favicon.ico extension?
You just create a favicon.ico with your logo or image and upload it to the folder where your index.html (or your default page).
You can easily create favicon (favicon.ico) from this online tools
http://tools.dynamicdrive.com/favicon/
I've used this to generate favicon for my website.
For eg: For my website (mansoor.in) I've uploaded favicon.ico here.

Favicon without HTML code

I noticed that Future Friendly's source code doesn't contain any code for their favicon. Yet, there is a blue star as their favicon in my browser's tab. Is this witchcraft?
you can just put a favicon.ico file in the root level of the website. in your sample http://futurefriend.ly/favicon.ico
You don't need code to reveal a favicon. Simply add the image to your site root folder and all newer browser (IE 7 +?) find it and show it automatically.