一聚教程网:一个值得你收藏的教程网站

热门教程

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

时间:2022-06-25 15:39:25 编辑:袖梨 来源:一聚教程网

如下所示:

$rootScope.$watch('title',function(title){
 var body = document.getElementsByTagName('body')[0];
 document.title = title;
 var iframe = document.createElement("iframe");
 iframe.title = '';
 iframe.;
 iframe.;
 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中,代码备份下,预防下次遇到同样的问题。

热门栏目