我在webview中加载了其他系统给出的网址。但是它没有显示所有内容,它在页面中留下了一个空白窗口。检查源代码,它有一个框架集标签和一些iframe标签。 att src是正确的。为什么它无法从src加载内容?webchromeclient是否支持php iframe标签?
<frameset id ="dispframeset" rows="*,6%" frameborder="NO" border="0" framespacing="0">
<frame id="articleFrame" src="/csp/kbs/showKngContent.action?inRecycle=&kngTblFlag=0&kngId=20130228152142812001&dispId=&articleFlag=true&relativeKngFlag=true&buttonFlag=true&coluKngType=2&kngPath=&coluKngName=&kngPointId=&kngPointName=&kngPointPath=&showType=1&backBtnFlag=&dispTmpPreview=&channelId=0&curChannelId=¤tChannelId=&isBackOrGoahead=&clickingLogFlag=" name="articleFrame" scrolling="no" resize/>
<frame id="articleButtonFrame" src="/csp/kbs/showKngButton.action?kngId=20130228152142812001&dispId=&kngTblFlag=0&buttonFlag=true&showType=1&channelId=0" name="articleButtonFrame" scrolling="auto" resize/>
</frameset>
顺便说一句,网络应用程序在IE浏览器中运行良好,但是很糟糕。
提前知道。
答案 0 :(得分:0)
据我所知,WebChromeClient支持iframe标记。就我而言,我已经通过以下方式将iframe标签提供给webview。
<iframe width=\"480\" height=\"270\" src=\"http://staging.snagfilms.com/modules/html5player.jsp?filmId=ed9195a0-a748-11e0-a92a-0026bb61d036&w=500\" frameborder=\"0\" allowfullscreen></iframe>
上面是iframe标记,我从服务器
获取myWebView = (CustomFacedWebView) findViewById(R.id.web_wrap_browser);
myWebView.getSettings().setPluginsEnabled(true);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setPluginState(PluginState.ON);
chromeClient = new MyChromeClient();
myWebView.setWebChromeClient(chromeClient);
myWebView.loadUrl(URL)
webRoot = (ViewGroup) findViewById(R.id.web_root_view);
systemRoot = (ViewGroup) webRoot.getParent();
private final class MyChromeClient extends WebChromeClient implements OnCompletionListener, OnErrorListener {
CustomViewCallback fullscreenCallback;
VideoView htmlVideoView;
@Override
public void onShowCustomView(final View view, final CustomViewCallback callback) {
super.onShowCustomView(view, callback);
fullscreenCallback = callback;
systemRoot.removeAllViews();
setContentView(view);
fullScreen = true;
............
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onShowCustomView(final View view, final int requestedOrientation,
final CustomViewCallback callback) {
super.onShowCustomView(view, requestedOrientation, callback);
systemRoot.removeAllViews();
setContentView(view);
setRequestedOrientation(requestedOrientation);
fullscreenCallback = callback;
}
@Override
public void onHideCustomView() {
super.onHideCustomView();
if(htmlVideoView != null) {
htmlVideoView.stopPlayback();
}
if(webRoot != null) {
systemRoot.removeAllViews();
setContentView(webRoot);
}
try{
if(fullscreenCallback != null)
fullscreenCallback.onCustomViewHidden();
} catch(Exception e) {
e.printStackTrace();
}
fullScreen = false;
}
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
onHideCustomView();
return false;
}
@Override
public void onCompletion(MediaPlayer mp) {
onHideCustomView();
}
}