首页 > 编程 > JavaScript > 正文

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

2019-11-19 12:57:18
字体:
来源:转载
供稿:网友

如下所示:

$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的解决方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表