我尝试使用iOS Native应用程序向网页发送一些(getWidth()
,getHeight()
,getSourceUrl()
)参数。我发现this可用,但我不知道如何解决这个问题?
网页模板(此模板适用于android)如下:
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>auto skip</title>
<script type="text/javascript">
window.onload = function(){
var width = window.javaControl.getWidth();
var height = window.javaControl.getHeight();
var imgUrl = window.javaControl.getSourceUrl();
var imgElH = document.getElementById("img_content_h");
imgElH.width = width;
imgElH.height = height;
imgElH.src = imgUrl;
}
</script>
</head>
<body>
<img id="img_content_h" alt="" />
</body>
我使用此代码,但它不起作用!
[self.bridge callHandler:@"getWidth" data:[NSNumber numberWithInt:320]];
[self.bridge callHandler:@"getHeight" data:[NSNumber numberWithInt:64]];
[self.bridge callHandler:@"getSourceUrl" data:@"http://211.155.89.163:28080/FlowKit/uploads/userinfo/20150527/C47F1DC39A31443ACF4EAF3802F06879.png"];