今日做项目。涉及到native和H5页面的交互
1.document.readyState
document.readyState:推断文档是否载入完毕。
firefox不支持。
这个属性是仅仅读的,传回值有下面的可能:
0-UNINITIALIZED:XML 对象被产生,但没有不论什么文件被载入。
1-LOADING:载入程序进行中。但文件尚未開始解析。
2-LOADED:部分的文件已经载入且进行解析,但对象模型尚未生效。
3-INTERACTIVE:仅对已载入的部分文件有效,在此情况下,对象模型是有效但仅仅读的。
4-COMPLETED:文件已全然载入。代表载入成功。[_webViewstringByEvaluatingJavaScriptFromString:@"document.readyState"];能够推断出当前webview载入状态
2。window.location.href
用window.location.href的就仅仅能在当前页面打开,不能打开新窗体的
3. ios运行JS代码。语句;stringByEvaluatingJavaScriptFromString
4. 改变userAgent