ios设备中angularjs无法改变页面title的解决方法

2023-05-24,,

如下所示:

$rootScope.$watch('title',function(title){
 var body = document.getElementsByTagName('body')[0];
 document.title = title;
 var iframe = document.createElement("iframe");
 iframe.title = '';
 iframe.width = 0;
 iframe.height = 0;
 iframe.setAttribute("src", "/empty.png");

 iframe.addEventListener('load', function() {
 setTimeout(function() {
  iframe.removeEventListener('load');
  document.body.removeChild(iframe);
 }, 0);
 });
 document.body.appendChild(iframe);
});

// 代码放在app.js中,代码备份下,预防下次遇到同样的问题。

以上这篇ios设备中angularjs无法改变页面title的解决方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持本站。

《ios设备中angularjs无法改变页面title的解决方法.doc》

下载本文的Word格式文档,以方便收藏与打印。