在某些ios版本的app上,经过web 调用app存在失败的想象,经过联调
发现JSbridge 这个地方并无发送请求ios
var WVJBIframe = document.createElement('iframe'); WVJBIframe.style.display = 'none'; WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__';
测试了好久,觉得是app缓存了iframe的请求形成的问题,
后来一想没准iframe 延迟建立,再赋予 WVJBIframe.src值的时候是空的对象,并无负值成功
因此代码追加了 setTime 测试正常了web
setTimeout(function(){ WVJBIframe.style.display = 'none'; WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__'; document.documentElement.appendChild(WVJBIframe); setTimeout(function () { document.documentElement.removeChild(WVJBIframe) }, 0); sessionStorage.phoneType = 'ios' },100)
此问题只在部分系统版本中出现,大部分没有问题。缓存