Home > Software engineering >  IFrame scrolling attribute set from onload event working differently on IE11 and edge/chrome
IFrame scrolling attribute set from onload event working differently on IE11 and edge/chrome

Time:03-24

I am setting attribute "scrolling" from onl oad event and it is working differently in IE11 and Edge

<head>
<script>
function myFunction() {
  document.getElementById("myFrame").scrolling = "no";  
}
</script>
</head>
<body onl oad="myFunction()">
<iframe id="myFrame" src="http://example.com/"></iframe>
</body>

This stops scrolling in Edge but not in IE11, when I open this on edge of IE emulation mode, there also scrolling is happening. Strangely other attributes like height and width work fine in both edge and IE11. What could be the problem here?

CodePudding user response:

As far as I know, the attribute scrolling is aleady deprecated, if you have to use this attribute in iframe, you can add it in html code manually instead of adding it dynamically through javascript.

Something like this:

<iframe id="myFrame" src="http://example.com/" scrolling="no"></iframe>

In addition, IE will end support soon. So I recommend that you focus more on modern browsers such as Microsoft Edge, Chrome instead of IE.

  • Related