iphone使用微信打开页面不能动态修改title的问题

来源:互联网 发布:tensorflow教程 视频 编辑:程序博客网 时间:2024/04/30 13:28

某人刚行进在移动前端开发的道路上,一日:

使用工具(平台):iphone  andriod 微信中打开网页;

需求:打开网页后,需要动态根据后端传回的数据再次修改页面中的内容(包括:背景、Logo、title。。。。);

问题:使用iphone打开后,title不能替换;

代码(解决方案):

setInterval(function(){<span style="white-space:pre"></span>var $body = $('body');<span style="white-space:pre"></span>document.title= Math.random();<span style="white-space:pre"></span>var $iframe = $('<iframe src="favicon.ico"><iframe>');<span style="white-space:pre"></span>$iframe.on('load',function(){<span style="white-space:pre"></span>setTimeout(function(){<span style="white-space:pre"></span>$iframe.off('load').remove();<span style="white-space:pre"></span>},0);<span style="white-space:pre"></span>}).appendTo($body);<span style="white-space:pre"></span>},1000);
条件:预先加载JQ;

原理及推论:未搜到好的方案,从群友(***菜***)处得到(微笑感激莫名),还未仔细研究(demo还不造怎么上传,亲测可以iphone5s)~

0 0