domUtil.js 563 B

123456789101112131415161718192021
  1. import config from '@/config/defaultSettings'
  2. export const setDocumentTitle = function (title) {
  3. document.title = title
  4. const ua = navigator.userAgent
  5. // eslint-disable-next-line
  6. const regex = /\bMicroMessenger\/([\d\.]+)/
  7. if (regex.test(ua) && /ip(hone|od|ad)/i.test(ua)) {
  8. const i = document.createElement('iframe')
  9. i.src = '/favicon.ico'
  10. i.style.display = 'none'
  11. i.onload = function () {
  12. setTimeout(function () {
  13. i.remove()
  14. }, 9)
  15. }
  16. document.body.appendChild(i)
  17. }
  18. }
  19. export const domTitle = config.title