iframe inserted by javascript doesn't load in web page Topic is solved

Users and developers helping users with generic and technical Pale Moon issues on all operating systems.

Moderator: trava90

Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
BZZZZ

iframe inserted by javascript doesn't load in web page

Unread post by BZZZZ » 2021-11-09, 14:19

I have this hosted as html file on local http server:

Code: Select all

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8"/>
  <title>iframe javascript test</title>
</head>
<body>
<script type="text/javascript">
{
  let elem;
  if(window===top){
    elem=document.createElement("iframe");
    elem.onload=()=>{
      const elem=document.createElement("h1");
      elem.textContent="iframe loaded";
      document.body.appendChild(elem);
    };
    elem.src=location.href;
  }else{
    elem=document.createElement("h1");
    elem.textContent="inside iframe";
  }
  document.body.appendChild(elem);
}
</script>
</body>
</html>
If I open it in firefox or chromium it shows (not to scale):

Code: Select all

┏━━━━━━━━━━━━━┓
┃inside iframe┃
┗━━━━━━━━━━━━━┛
iframe loaded
If I open it in palemoon it shows (not to scale):

Code: Select all

┏━━━━━━━━━━━━━┓
┃             ┃
┗━━━━━━━━━━━━━┛
Why is it different in palemoon?

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35625
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: iframe inserted by javascript doesn't load in web page

Unread post by Moonchild » 2021-11-09, 15:18

BZZZZ wrote:
2021-11-09, 14:19
Why is it different in palemoon?
We don't allow iframes to recursively load themselves (which is a known "evil trap")

EDIT: It seems Firefox allows this to satisfy some automated tests (assuming the same goes for Chrome)
I don't particularly see a reason to allow nested iframes with the same URL/location; it's risky.

EDIT2: Firefox allows this because WPT tests expect this. WPT tests expect this allowance because Chromium does. So basically Chromium determines Firefox's behaviour here by way of having "expected" results of what is supposed to be an independent test platform be shaped after Chromium's implementation.
If there was ever a clear indicator that Google controls the reference other browsers are forced to match against, this is it.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked