The course of action that you select will depend greatly on how much of a priority this issue is to you. There are a number of ways to set scrollbar options on an iFrame, from simple to complex. Window.attachEvent("onmessage", resizeIFrame) Window.addEventListener("message", resizeIFrame, false) Var myIFrame = document.getElementById('myIFrame') If (event.origin != loc.protocol + '//' + loc.host) return The iFrame’s dimensions are reset according the the event data’s w and h properties – that’s the first argument passed to the postMessage() function above: Inside the function, the first line verifies the sender’s identity using the origin property in order to thwart cross-site scripting attacks. In the parent document, we need to attach an event handler to the postMessage event that accepts an event as its argument. This is child2this is child2this is child2this is child2this is child2this is child2this is child2this is child2this is child2this is child2 If you want it the other way around, you have to apply the rules dynamically via scripting, for instance: function setIframeSize(iframe), loc.protocol + '//' + loc.host) IFRAME NO SCROLL HOW TOIn essence, the child document is telling the parent how to display it. This will disable both horizontal and vertical scroll bars. Instead, you have to apply the CSS values to the child document’s or tag. 1) Set the scrolling attribute of the iframe to no (scrollingno). However in practice, this doesn’t have any effect. It would seem evident that if you wanted to show a vertical scrollbar and suppress the horizontal one you would apply a style of “overflow-y:scroll overflow-x:hidden” to the element. It replaced the “yes” and “no” values with “scroll” and “hidden” (“auto” remained), while offering additional values of “visible”, “initial”, and “inherit”. It could be set to “auto”, which means that scrollbars appear if needed (the default behavior), “yes” (scrollbars are always shown, whether needed or not), and “no” (scrolbars are never shown, even when needed).Īlthough still supported in all major browsers, the scrolling attribute has largely been eclipsed by the CSS overflow, overflow-x, and overflow-y CSS properties. Adam is a technical writer who specializes in developer documentation and tutorials. Originally, iFrame scrollbars were set using the scrolling attribute. What does
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |