# favicon-setter

> Super-simple tool for dynamically setting the favicon image on a page.

Latest version **0.1.1** (published 2013-08-29) · 0 weekly downloads

## Install

```sh
npm install favicon-setter
pnpm add favicon-setter
yarn add favicon-setter
bun add favicon-setter
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2013-08-29 |
| First published | 2013-01-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Henrik Joreteg |
| Maintainers | henrikjoreteg |
| Keywords | favicon, browser, browserify |

## Links

- npm: https://www.npmjs.com/package/favicon-setter
- Repository: git@github.com:HenrikJoreteg/favicon-setter
- npm.io page: https://npm.io/package/favicon-setter

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2013-08-29
- 0.1.0 — 2013-08-29
- 0.0.1 — 2013-01-21

## README

# favicon-setter

Super simple util for setting the favicon of a page:

- No dependencies
- Only works in browsers that let you dynamically set favicons: FF, Opera, Chrome
- Is exported as CommonJS for those who like that <3
- Becomes a jQuery plugin if not commonJS and jquery is on the page
- Else add a `setFavicon` function to the `window`

## How to use it:


Step 1. include it:

```html
<script src="favicon-setter.js"></script>
```

Step 2. Set your favicon like so:

```js
window.setFavicon('/new-url.png'); // should be 16x16 image (pngs are best)
```

That's it!


## CommonJS Version

If you're using this on the client but your project is in node.js you can install this with: https://github.com/henrikjoreteg/clientmodules and npm:

```
npm install favicon-setter
```

Then just do this:

```js
var setFavicon = require('favicon-setter');

setFavicon('/new-url.png');
```

## jQuery

If you've got jquery on the page, insert this after including jQuery.

```js
$.setFavicon('/new-url.png');
```

## Restoring the original

Just one other little trick. If the original favicon was set by using a `<link rel="shortcut icon">` tag then you can restore the original after setting it by calling `setFavicon()` without any arguments.

## Credits

Props to [@mathias](http://twitter.com/mathias) for this: https://gist.github.com/428626 which served as starting point for this code.


## License

MIT

If you like this, follow [@HenrikJoreteg](http://twitter.com/henrikjoreteg) on the twitterwebz.

---
_Source: https://npm.io/package/favicon-setter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
