javascript - 请问嵌入别的网页除了使用iframe,还能有别的方法吗?
仅有的幸福
仅有的幸福 2017-05-19 10:17:11
0
1
888

如题,比如我的页面要嵌入baidu.com 除了使用iframe标签还有别的办法吗?

问题由来:我的项目是嵌套在android的webview里,但当我嵌入sina.com、qq.com之类的;webview就会被这些网页强制占用。
截图如下:
①正常情况:

②被占用情况:

③补充:

    var iframe = '<p style="width: 100%; height: 100%;position:relative;">  <iframe src="' + this.data.itemData.url + '" style="width: 100%; height: 100%;" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" border="0" frameborder="0">如果长时间未加载,请检查网络状况或网址!</iframe><p' + '>';
        $this.appDom.html(iframe);

原因已找到:正如答主所言“有很多网站不喜欢被 iframe 的,会用各种手段跳出来。”,比如某新闻网站的代码

<!-- 反运营商劫持 S -->
<style type="text/css">
    html {
        display:none;
    }
    </style>
<script>
    if( self == top ) {
        document.documentElement.style.display = 'block' ;
    } else {
        top.location = self.location ;
    }
    </script>

解决方案还没找到

仅有的幸福
仅有的幸福

全部回复(1)
仅有的幸福

安卓打开 webview 可以是复数的,跟 App 端沟通看看。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!