Skip to content

[html] 第317天 iframe如何自动调整高度? #1967

Open
@haizhilin2013

Description

@haizhilin2013

第317天 iframe如何自动调整高度?

我也要出题

Activity

longhui520

longhui520 commented on Feb 27, 2020

@longhui520
  • 未跨域时,在iframe中利用他的父窗口对象将本页面的滚动高度设置给iframe的height
  • 跨域时,在iframe中将自己的的滚动高设置在本页面内的一个隐藏于父页面不跨域的iframe的hash值,
    在隐藏的iframe中将值取出,同未跨域一样设置到要自动调节高度的iframe的height
  • iframe 自动调节
forever-z-133

forever-z-133 commented on Feb 28, 2020

@forever-z-133

其实并不推荐这么做,苹果机上 iframe 就设不了高度,所以 iframe 的高度最好由其外层 div 来调节。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@forever-z-133@longhui520

        Issue actions

          [html] 第317天 iframe如何自动调整高度? · Issue #1967 · haizlin/fe-interview