問題描述:web
當咱們用微信瀏覽器打開頁面時候,想要動態修改title值,就須要使用:瀏覽器
document.title = "title"
可是IOS系統下,微信等webview中沒法修改第一個頁面的title,在從這個頁面點擊進去的其餘頁面就能夠修改微信
解決辦法:微信開發
function SetTitle(name){ var ua = navigator.userAgent.toLowerCase(); if (/iphone|ipad|ipod/.test(ua)) { var $body = $("body"); document.title = name; // hack在微信等webview中沒法修改document.title的狀況 var $iframe = $("<iframe src='/favicon.ico'></iframe>"); $iframe.on("load",function() { setTimeout(function() { $iframe.off("load").remove(); }, 0); }).appendTo($body); } else { document.title = name; } } module.exports = SetTitle;
問題描述:app
在微信開發中,咱們在使用事件委託時候,若是委託的父元素是body,IOS下不會起做用,只有事件主動觸發,該事件纔會被觸發iphone
錯誤用法:code
$('body').on('click', '.js_list li', function(){ //xxx });
正確用法:事件
$('.js_list').on('click', 'li', function(){ //xxx });