ionic-content 中iframe高度自适应

本文介绍了如何解决网页中iframe加载外部URL及调整其高度至全屏的问题。具体包括使用AngularJS安全地设置iframe源及确保内容完全显示的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://blog.youkuaiyun.com/jesounao/article/details/50945003
无法访问外部url的问题–两个步骤解决:
1.iframe的src属性用ng-src属性替代,并指明绑定对象:ng-src="{{targetUrl}}"

2.在controller里,调用$sce: $scope.targetUrl = $sce.trustAsResourceUrl(url)

高度无法最大化的问题–两个步骤:
1.ion-content 属性里添加 scroll="true" overflow-scroll="true"

2.iframe的style里添加 min-height: 100%

<ion-modal-view>
    <ion-header-bar>
        <h1 class="title">无法登录</h1>
        <div class="buttons">
            <button class="button" ng-click="closeModal()">取消</button>
        </div>
    </ion-header-bar>
    <ion-content scroll="true" overflow-scroll="true">
        <iframe src="http://www.zehuiwenhua.com/guoxue/content.html?k=guoxue-content-cannot-login" frameborder="0" style="width:100%;height:100%;"></iframe>
    </ion-content>
</ion-modal-view>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值