Requirements: Enter different detail pages in the public account, display different activity titles, android, ios display after disappearing.

Document. title Sets the title of the current page, which is displayed normally in H5, but not in ios and Android.

Cause: In wechat browser, the title is displayed during initialization, and the change of title onChange cannot be monitored. Add iframe tag, delete, call wechat browser onload event, reset the title.

Operation:

   document.setTitle = function(t) {
    document.title = t;
    var i = document.createElement('iframe');
    i.src = '//m.baidu.com/favicon.ico';
    i.style.display = 'none';
    i.onload = function() {
      setTimeout(function(){
        i.remove();
      }, 9)
    }
    document.body.appendChild(i);
  }
  setTimeout(function(){
    document.setTitle('hello')
  }, 500)


Copy the code