HTML5 iFrame Seamless Attribute

后端 未结 10 1033
日久生厌
日久生厌 2020-11-27 14:41

in HTML5 the iframe has new attributes like \'seamless\' that should remove borders and scrollbars. I\'ve tried it but doesn\'t seem to work, I still can see scrollbars and

相关标签:
10条回答
  • 2020-11-27 15:25

    You only need to write

    seamless

    in your code. There is not need for:

    seamless ="seamless"

    I just found this out myself.

    EDIT - this does not remove scrollbars. Strangely

    scrolling="no" still seems to work in html5. I have tried using the overflow function with an inline style as recommended by html5 but this doesn't work for me.

    0 讨论(0)
  • 2020-11-27 15:27

    I couldn't find anything that met my requirements, hece I came up with this script (depends on jQuery):

    https://gist.github.com/invernizzie/95182de86ea9dc5daa80

    It will resize the iframe to the viewport size (taking into account wider content). It could use an improvement to use the viewport height instead of the content height, in the case that the former is bigger.

    0 讨论(0)
  • 2020-11-27 15:31

    Still at 2014 seamless iframe is not fully supported by all of the major browsers, so you should look for an alternative solution.

    By January 2014 seamless iframe is still not supported for Firefox neither IE 11, and it's supported by Chrome, Safari and Opera (the webkit version)

    If you wanna check this and more supported options in detail, the HTML5 test site would be a good option:

    http://html5test.com/results/desktop.html

    You can check different platforms, at the score section you can click every browser and see what's supported and what's not.

    0 讨论(0)
  • 2020-11-27 15:37

    Use the frameborder attribute on your iframe and set it to frameborder="0" . That produces the seamless look. Now you maybe saying I want the nested iframe to control rather I have scroll bars. Then you need to whip up a JavaScript script file that calculates height minus any headers and set the height. Debounce is javascript plugin needed to make sure resize works appropriately in older browsers and sometimes chrome. That will get you in the right direction.

    0 讨论(0)
提交回复
热议问题