关于出现WebActionDisablingCALayerDel
2018-07-15 本文已影响605人
李Mr
原因分析
出现这种问题一般是网页报错导致,只需要网页中添加一段css样式就可以解决:
-webkit-transform:translateZ(0px)

如果无法去网页端修改,那么客户端可以进行注入css代码来解决,
以iOS客户端为例:
//定义要注入的css代码,这段代码是往页面head便签中添加style样式
NSString *const INJECT_CSS = @"var head = document.getElementsByTagName('head');
var tagStyle=document.createElement(\"style\"); tagStyle.setAttribute(\"type\", \"text/css\");
tagStyle.appendChild(document.createTextNode(\"iframe{-webkit-transform:translateZ(0px)}\"));
head[0].appendChild(tagStyle);";
//OC注入css代码
- (void)webViewDidStartLoad:(UIWebView *)webView{
//注入css,解决购物车页面报WebActionDisablingCALayerDelegate的错误。
[webView stringByEvaluatingJavaScriptFromString:INJECT_CSS];
}
注入后网页代码如下:
