解决ios设备中angularjs无法改变页面title的问题
2015-12-03 15:00
549 查看
$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-Pch常用代码
- nagios_create_services.sh
- IOS 通知
- IOS项目集成ShareSDK实现第三方登录、分享、关注等功能。
- iOS中layoutSubviews的调用
- 在iOS和OSX双平台上的字符串格式化
- iOS报错:does not contain bitcode Xcode7
- iOS-----使用GCD实现多线程
- iOS开发多线程篇—GCD的常见用法(二)
- iOS开发之storyboard的小技巧
- Xcode单元测试之-lmobilesp
- iOS 旋转动画(图片360°旋转)关键代码
- IOS-TextField知多少
- iOS开发地图计算两个地点之间的距离
- iOS —— ARC、MRC 下dealloc 方法存在的意义
- iOS —— 简述OC 的内存管理机制
- iOS开发多线程篇—GCD的常见用法(一)
- 正则表达式--iOS开发
- iOS 音视频合成