You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
436 B
JavaScript
11 lines
436 B
JavaScript
import {$image} from "~/api";
|
|
|
|
export const $favicon = (path, t = false) => {
|
|
const link = document.querySelector("link[rel*='icon']") || document.createElement('link')
|
|
link.type = 'image/x-icon'
|
|
link.rel = 'shortcut icon'
|
|
let href = $image(path)
|
|
link.href = t ? [href, 't=' + String(new Date() / 1)].join(href.indexOf('?') === -1 ? '?' : '&') : href
|
|
document.getElementsByTagName('head')[0].appendChild(link)
|
|
}
|