1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Changing favicon.ico in Tomato

Discussion in 'Tomato Firmware' started by TheKid, Jan 29, 2008.

  1. TheKid

    TheKid LI Guru Member

    So. . . trivial, I know, but I love a challange! :biggrin:

    How would *you* change the favicon.ico on your router (Tomato 1.15 installed)? I tried to do this last night in /www, but the favicon.ico file is locked, read-only as a system file. Couldn't CHMOD or anything to replace the file. . . Couldn't unmount/mount the filesystem to change the icon. No joy regardless of what I tried.

    I made a "pretty" new icon I'd like to use (attached), but. . .

    There's now way to use a 'custom.css' to call the icon as far as I know, and I can't mod the HTML code, replacing the code that calls it (which seems the easiest thing to do -- if you could get at the calling file or just the icon itself).

    Anyway. . . a challenge. . . that I really don't want to recompile the entire BIN for.

    Anyone have any thoughts?

    Thanks!

    -- Kid
     

    Attached Files:

  2. mstombs

    mstombs Network Guru Member

  3. TheKid

    TheKid LI Guru Member

    Yeah, I know about the custom style sheets, but you can't replace the favicon.ico with CSS. It's called from the HTML code, which like the icon, is a read-only/system file, that can't be changed once the BIN is installed.

    The favicon.ico is the icon that appears in the browser's tab and/or title bar.

    Thanks though.
     
  4. mstombs

    mstombs Network Guru Member

  5. TheKid

    TheKid LI Guru Member

    So, no HTML/CSS guru out there has any other ideas how this might be done without recompiling the BIN?

    There's got to be some way! The impossible is always possible -- somehow! ;)
     
  6. rnelsonee

    rnelsonee Guest

    Two ways

    If you're using Firefox, there is a favicon Add-On that lets you choose icons for any website. It's not an elegant solution, but it's what I use.

    https://addons.mozilla.org/en-US/firefox/addon/3176

    I was also thinking about just editing the .bin file directly, but I can't find the favicon's data in the .bin file - I'd imagine the file is getting compressed/interpreted by the compiler. Even if you could hex edit the icon directly, I'd imagine there's a MD5 hash or CRC type check at the end after the firmware is uploaded...
     
  7. dolly_oops

    dolly_oops Network Guru Member

    Here's how you can do it!

    By cheating! :D

    I would suggest that you could actually get Jon to add that functionality into Tomato properly so that you wouldn't have to do something as sneaky as I'm about to suggest...

    Basically, SSH into the router, and use the nvram command to see what your web_css value is.
    Mine is:
    Code:
    web_css=olive
    Because it is in the HEAD block, which is where you can set a new location for the favicon, you just take advantage of the fact that Tomato will just output the nvram value directly into the HTML. In this case, it does this:
    Code:
    <link rel='stylesheet' type='text/css' href='XXXX.css'>
    The value of XXXX is the value of web_css. So if you change the setting like this:

    Code:
    nvram set web_css="olive.css'><link rel='shortcut icon' href='http://en.wikipedia.org/favicon.ico'><link rel='stylesheet' type='text/css' href='olive"
    Then it will get the favicon from Wikipedia and use that. We're just manually completing the stylesheet declaration, inserting a shortcut icon, and then duplicating the beginning of the stylesheet declaration to be finished off by Tomato. A bit like Cross Site Scripting, but in a good way. :)

    Hope that helps.
     
    irouy likes this.

Share This Page