首页 > 解决方案 > GWT Java - 如何在面板或小部件中显示另一个外部网页?

问题描述

我需要一个面板或小部件来设置 URL,并且该面板/小部件在其中显示 URL 的网页。类似于 WebView 和 UIWebView 在 Android 和 iOS 应用程序中的工作方式。

标签: javagwt

解决方案


一种解决方案是使用带有 iFrame 的 HTMLPanel

    HTMLPanel htmlPanel = new HTMLPanel("<iframe src=\"https://www.youtube.com/embed/dQw4w9WgXcQ\" style=\"width:600px; height:600px;\" >Unfortunately this content could not be displayed</iframe>");
    RootPanel.get("mainDiv").add(htmlPanel);

推荐阅读