1

Document.title represents the name of a tab in javascript. For example, javascript: a=prompt("Create a new name for the tab"); document.title=a; void(0) lets you change the name of the tab. you're on temporarily if you type it into the google search bar (Be careful, when you paste it, the javascript: part won't copy so you'll have to type that in yourself.) Is there anything like that for the icon of the tab? like the picture next to the title? I would like to be able to temporarily change that too.

Also, apparently my questions are bad. My last two questions got -4 and -6 respectively. If you would like to I'd love some constructive criticism!

1 Answers1

0

The icon next to the website's title is called the Favicon.

To directly answer your question, there is nothing like document.icon. But I like the idea :)

Favicons come in many forms and sizes:

  • <link rel="shortcut icon">
  • <link rel="apple-touch-icon"> (see Apple’s documentation)
  • <link rel="apple-touch-icon-precomposed">
  • <meta name="msapplication-square70x70logo"> (see Microsoft docs)

You can also use FaviconKit (I’m the maker) and get e.g. Stackoverflow’s favicon like

https://api.faviconkit.com/stackoverflow.com/128

(replace stackoverflow.com and 128 with your own domain and required size).

In your bookmarklet you could do something like

document.icon = 'https://faviconkit.com/?url=' + document.URL

and then reference document.icon whenever you need it.

AndreasPizsa
  • 1,736
  • 19
  • 26