Favicon link does download instead of show - favicon

I have a favicon on my page, and when i go to the link for the favicon: mypage/favicon.ico
It starts download, instead of just showing it as an online image (as every other site).
I've searched everywhere for a solution, but got no answer.
I want it to show, and not to be downloaded, what can be the problem?
<head>
<link rel="shortcut icon" href="/favicon.ico">
</head>
Its an .ico file at 32x32.
Thanks - Chris

You can show it in HTML as a regular image tag. This has been tested in Firefox 26, Chrome 29 and Internet Explorer 10. All with positive results. You can try on your own browsers if you'd like.
Code:
<!DOCTYPE html>
<html>
<body>
<img src = "logo.ico" type = "image/x-icon">
</body>
</html>

You should use
<head>
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
</head>
And consider to use another image e.g .png
<link rel="icon" href="/favicon.png" type="image/png" />
(Some Browsers does not support .ico)
If you call mypage/favicon.ico directly it might be dowloaded, depending on your http server/browser which mime type should be downloaded or displayed.
see Wikipedia.

Related

Github Pages not loading my project

I am trying to create a GitHub Pages for one of my existing repositories. When I click on "Your site is published at ..." I just get a blank screen. Here is the link to the site: https://mrcj101111.github.io/Clipboard/
The page is correct. Your Body is empty, in the below example I added an h1 header with the a value of "geckos-23".
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<title>geckos-23</title>
</head>
<body>
<h1>geckos-23</h1>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

Favicon is not showing if the URL starts with https://

I am facing one issue with favicon.ico. Here is my link rel code which has been included in header portion.
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
The problem is, I can view the favicon in all browsers if the url starts with http://. When the address starts with https://, the favicon is not showing in IE browser. Is there anything that I need to do? Did I miss anything important to include?
I had the same problem and fixed it by putting the following line in the head section of my html file:
<link rel="shortcut icon" href="">

Favicon won't load, even when going to the direct URL

The favicon isn't working on my site. If I go to google.com/favicon.ico I see the image displayed. But for some reason on my site, lucasjohnson.co.uk/favicon.ico prompts me to download a file. I have even tried replacing my own favicon with Google's, but I still have the same problem.
Edit: The file ico file was converted from a png using Dynamic Drive's FavIcon Generator.
I checked http://www.lucasjohnson.co.uk/favicon.ico, and the response content-type is text/plain. There are several content types that can be used for favicon, but text/plain is not one of them.
The most common ones are image/x-icon and image/vnd.microsoft.icon.
So basically, just choose one of the following content types and add it to your link tag:
<link rel="icon" type="image/vnd.microsoft.icon" href="http://www.lucasjohnson.co.uk/favicon.ico" />
<link rel="icon" type="image/png" href="http://www.lucasjohnson.co.uk/favicon.ico" />
<link rel="icon" type="image/gif" href="http://www.lucasjohnson.co.uk/favicon.ico" />
<link rel="icon" type="image/x-icon" href="http://www.lucasjohnson.co.uk/favicon.ico" />
See http://en.wikipedia.org/wiki/Favicon for more details.
BTW, regardless (or not) of this problem, I've noticed that you're not closing one of your meta tags:
<meta name="viewport" content="width=device-width">

iPhone ignoring CSS Stylesheet

I'm working on my very first (very lame) website, so apologies for the n00b question.
In Chrome/FF/Safari, my site renders the CSS fine. But on my iPhone or iPad (Chrome or Safari), my site renders as if there were no CSS styles at all. What's the cause?
Link to site
Thanks in advance!
you are referencing localhost for your stylesheet
<link rel="stylesheet" href="http://localhost:8888/kirbydev/assets/styles/styles.css" />
needs to be
<link rel="stylesheet" href="http://www.tvsonsale.co.uk/kirbydev/assets/styles/styles.css" />
or relative path so it works on local dev and production:
<link rel="stylesheet" href="/kirbydev/assets/styles/styles.css" />

Relative url automatic rewrite in asp.net MVC 2

ASP.net MVC 2 does rewrite all your relative urls in the <link> tag to the full relative path, which is good but it only works for URLs written in the <link> tag only, not <script> tags or any other elements.
Create an MVC 2 web application
create any controller and a view for it
inside the view create a <link> tag like this <link href="test.xml" type="text/css"/>
run your application, navigate to the view you created and then view source
you will find that MVC has rewritten your url in tag to full url like:
<link href="../Views/Home/Text.xml" type="text/css" />
i know that this file is in the Views folder and can't be viewed due to the web.config file that blocks any requests to files there, but thats not my problem
How can i get MVC to rewrite all urls not only in the <link> tage ?
Any help would be appreciated.
This happens because your <head> tag has a runat="server" attribute (a nasty heritage from WebForms). Remove it and no rewrites will happen. Also instead of:
<link href="test.css" type="text/css" />
you should always use Url helpers when dealing with urls:
<link href="<%= Url.Content("~/test.css") %>" type="text/css" />
You should not leave automatic rewrites to happen, always use Url.Content for linking static resources.
perhaps you have already tried something like this
<head runat="server">
<link href="test.xml" type="text/css"/>
<script src="<%= ((WebFormView)this.ViewContext.View).ViewPath.Substring(1,
((WebFormView)this.ViewContext.View).ViewPath.LastIndexOf('/')) %>test1.xml" type="text/javascript"></script>
</head>
renders html as
<head>
<link href="Views/Shared/test.xml" type="text/css" />
<script src="/Views/Home/test1.xml" type="text/javascript"></script>
</head>