Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Changing the favicon using this extension #12

Description

@skykit-benjohnson

(See my post here on the Jupyter forums)

New to notebook extensions and most all web development concepts. I’m attempting to change JupyterLab’s favicon using this cookiecutter theme, with the ultimate goal of being able to change the favicon based on a config file. I’m using a slight modification of this SOF post, included within my src/index.ts file.

let head = document.head || document.getElementsByTagName('head')[0];

function changeFavicon(src: string) {
  let link = document.createElement('link'),
       oldLink = document.getElementById('dynamic-favicon');
  link.id = 'dynamic-favicon';
  link.rel = 'icon';
  link.type = 'image/x-icon';
  link.href = src;
  if (oldLink) {
    head.removeChild(oldLink);
  }
  head.appendChild(link);
}

When I call…

changeFavicon('http://www.google.com/favicon.ico');

…the favicon changes appropriately. But how would I access a favicon.ico file stored within my very own local extension directory?

A step further, how could I change the path to different favicon files using a config file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions