Results 1 to 7 of 7

Thread: How to set favicon?

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    59

    Default How to set favicon?

    Hi,

    how do I define the favicon for the app? OK; I could put
    Code:
    <link rel="shortcut icon" href="favicon.ico" type="image/ico" />
    into app.html, but app.html gets overidden on save...

    Thank you

  2. #2
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,488

    Default

    Hrm, it should probably be an option on the Application node.

    For now, you will have to create a duplicate of app.html and handcode it in. Sorry for the not so great answer, but that would be the current workaround.
    Aaron Conran
    @aconran

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    59

    Default

    No problem, works for me.

  4. #4
    Sencha Premium Member
    Join Date
    Feb 2009
    Posts
    317

    Default

    The other thing that would be nice to have in the application settings is the ability to set the <title> attribute of the generated page.

    If title and favicon were included in the generated app.html file, I would no longer need to synchronize all the tags between app.html and our index.jsp file.

  5. #5
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Baton Rouge, LA
    Posts
    178

    Default Late to the party, but.....

    If you put this code in your App onLaunch function, it will set a favicon. The rendering is slightly delayed but acceptable:

    var link = document.createElement('link');
    link.type = 'image/x-icon';
    link.rel = 'shortcut icon';
    link.href = 'http://yourhost/yourapp/favicon.ico'; //assumes favicon is in the app root as it should be
    document.getElementsByTagName('head')[0].appendChild(link);

  6. #6
    Sencha Premium User
    Join Date
    Mar 2011
    Location
    Farmers Branch, TX
    Posts
    60

    Default Setting the page title

    You can use this in the Application.launch() function to set the title

    Ext.getDoc().dom.title = 'My Wonderful App';

  7. #7
    Sencha Premium User
    Join Date
    Mar 2011
    Location
    Farmers Branch, TX
    Posts
    60

    Default Relative favicon

    You can also use a relative path like this:

    Code:
            var link = document.createElement('link');
            link.type = 'image/ico';
            link.rel = 'icon';
            link.href = 'images/favicon.ico';  // I like putting it in my /images directory
            document.getElementsByTagName('head')[0].appendChild(link);
    Since code may be deployed to different URLs, maintaining a fixed URL can be nasty.

    See: http://www.w3.org/2005/10/howto-favicon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •