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

今天小编就为大家分享一篇ios设备中angularjs无法改变页面title的解决方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

如下所示:

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

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/33fe46b85377a80c82767d3e90c4bb60.html