简体   繁体   English

为什么iframe可以在Android 4.0+ ICS上的webview中工作?

[英]Why iframe works in webview on Android 4.0+ ICS?

I load a Google Docs' iframe into a webview in Android, this iframe is loading a PPT file (Power Point file) from a external server of Google Docs. 我将Google Docs的iframe加载到Android的Web视图中,该iframe从Google Docs的外部服务器加载了PPT文件(Power Point文件)。 This is the Android Code: 这是Android代码:

public class Test_iframeActivity extends Activity {

private WebView webView;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    webView = (WebView) findViewById(R.id.wv);
    webView.getSettings().setJavaScriptEnabled(true);

    //String customHtml = "<html><body><h1>Hello, WebView</h1></body></html>";
    String customHtml = "<iframe src='http://docs.google.com/viewer?url=http://www.iasted.org/conferences/formatting/presentations-tips.ppt&embedded=true' width='100%' height='100%' style='border: none;'></iframe>";
    webView.loadData(customHtml, "text/html", "UTF-8");
}}

My question is... why I can see the iframe works fine into Android 4.0 but I can't see it into Android 2.1 to 2.3? 我的问题是...为什么我可以看到iframe在Android 4.0中运行良好,但在Android 2.1至2.3中却看不到它? (I don't know if in Android 3 works). (我不知道在Android 3中是否可以工作)。

SOLVED! 解决了!

The mistake was the ASCII encoding... I shoud replace the #, %, /, and ? 错误是ASCII编码...我应该替换#,%,/和? by other characters, please check http://developer.android.com/reference/android/webkit/WebView.html#loadData(java.lang.String , java.lang.String, java.lang.String) for more information. 其他字符,请检查http://developer.android.com/reference/android/webkit/WebView.html#loadData(java.lang.String,java.lang.String,java.lang.String )了解更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM