Jump to content


Recommended Posts

The standard generated index file in smart doesn't contain a link tag for a favicon (something like

<link id="favicon" rel="icon" href="res/favicon.png" type="image/png" sizes="16x16">

However this can be added in code (or add it manually to the default.html file in the template directory, or add it to a Custom Template in the ide)

In code :

procedure TForm1.InitializeForm;
  // this is a good place to initialize components

  var link   := w3_createHtmlElement('link');
  link.id    := 'favicon';
  link.href  := 'res/favicon.png';
  link.rel   := 'icon';
  link.&type := 'image/png';
  link.sizes := '16x16';

If you want to change the icon later on, you can do that too

procedure TForm1.W3Button1Click(Sender: TObject);
  var favicon := browserapi.document.getElementById('favicon');
  favicon.href := 'res/favicon2.png';

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now