How to delete default favicon.ico

2,066 views
Skip to first unread message

s...@bykov.odessa.ua

unread,
Jul 5, 2012, 9:30:39 PM7/5/12
to mojol...@googlegroups.com
Hello. How to disable default /favicon.ico ?
Or how to rewrite it in my embedded application? /public/favicon.ico
file exists, but does not overwrite a default one

Thanks

bvn13

unread,
Jul 6, 2012, 12:44:38 AM7/6/12
to mojol...@googlegroups.com
in the <head> of the <html> you must put:

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

to turn on your favicon

s...@bykov.odessa.ua

unread,
Jul 6, 2012, 1:10:17 AM7/6/12
to mojol...@googlegroups.com
)))
I mean how to disable (rewrite or delete) the resource in my embedded
app, not in html code.
> in the <head> of the <html> you must put:
>
> <link href="/favicon.ico" rel="icon" type="image/x-icon" />
>
> to turn on your favicon
> --
> You received this message because you are subscribed to the Google
> Groups "Mojolicious" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mojolicious/-/xH0g_Pd2fTsJ.
> To post to this group, send email to mojol...@googlegroups.com.
> To unsubscribe from this group, send email to
> mojolicious...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mojolicious?hl=en.


Abhijit Menon-Sen

unread,
Jul 6, 2012, 2:01:48 AM7/6/12
to mojol...@googlegroups.com
You should not need to do anything more than putting your own
favicon.ico in public/. Are you sure the built-in icon is not
just cached in the browser?

-- ams

David Oswald

unread,
Jul 6, 2012, 2:11:50 AM7/6/12
to mojol...@googlegroups.com
On Thu, Jul 5, 2012 at 11:01 PM, Abhijit Menon-Sen <a...@toroid.org> wrote:
> You should not need to do anything more than putting your own
> favicon.ico in public/. Are you sure the built-in icon is not
> just cached in the browser?

This is good advice. I found recently that browsers are stubborn
about trying to cache favicon.ico on a per-domain basis. Often one
must clear the browser's cache, close the browser, and then re-start
it to see a change.

Additionally, although the advice to put favicon.ico into /public is
correct in general, I found that with dotcloud, I had to put it into
/static, because even though Mojolicious apps will look at /public to
find static content, Dotcloud's nginx server will look in /static when
trying to serve favicon.ico.

So you may need to consider where your server wants to find static
files, as opposed to where Mojolicious likes them to be placed.

--

David Oswald
daos...@gmail.com

s...@bykov.odessa.ua

unread,
Jul 6, 2012, 4:14:02 AM7/6/12
to mojol...@googlegroups.com
OK. May be you don't understand me because of my bad English. I'll try
another way.

How can I change this test in 1-2 lines, or this is a bug?
(https://gist.github.com/fefdf621a917ede71a74)

#!/usr/bin/env perl

use Mojo::Base -strict;
use Test::More 'no_plan';
use Mojolicious;
use Test::Mojo;
use File::Temp qw/tempdir/;
use IO::File;

sub e_app {

# Simple app
my $eapp = Mojolicious->new();
$eapp->routes->route('/test')->to(cb => sub {
shift->render_text('emb') });
return $eapp;
}

sub p_app {
my ($embedded, $host) = @_;

# Parent app with embedded on emb.host
my $app = Mojolicious->new();

# virtual hosting. Embedded app
$app->routes->route('/')->over(host => $host)->detour($embedded);
$app->routes->route('/test')->to(cb => sub {
shift->render_text('parent') });
return $app;
}


# Parent and child, embedded via host emb.host.
my $E_HOST = 'sub.host';
my $e_app = e_app;
my $p_app = p_app($e_app => $E_HOST);

# test our virtual host logic.
Test::Mojo->new()->app($p_app)->get_ok("/test")->content_is('parent');
Test::Mojo->new()->app($p_app)->get_ok("/test", {Host => $E_HOST})
->content_is('emb');


# create our own favicon for embedded app
my $pub = $e_app->static->paths->[0] = tempdir;
IO::File->new(do { join '/', $pub, 'favicon.ico' }, 'w')->print('popa');

# /favicon.ico must be different now!!!!!!!!!!!!
Test::Mojo->new()->app($e_app)->get_ok('/favicon.ico')->content_is('popa');
Test::Mojo->new()->app($p_app)->get_ok('/favicon.ico',, {Host => $E_HOST})
->content_is('popa');




s...@bykov.odessa.ua

unread,
Jul 6, 2012, 6:57:31 AM7/6/12
to mojol...@googlegroups.com
yes, I'm sure. I've wrote one simple test
https://gist.github.com/fefdf621a917ede71a74 to explain my problem

s...@bykov.odessa.ua

unread,
Jul 6, 2012, 6:11:06 PM7/6/12
to mojol...@googlegroups.com
Somebody can help? :-(
Does anybody use moun by host feauture?
Reply all
Reply to author
Forward
0 new messages