Users Pricing

forum

Home Forums document.body.appendchild has a null value. – MindStick

document.body.appendchild has a null value.

Anonymous User 3595 23 Mar 2015

I am loading a .js file I wrote. Within that .js file I am creating a Iframe like this.

var frmSource = "http://MYLINK.com/mypage.html?" + encodeURI(URLBuilder);
    ifrm = document.createElement("IFRAME");
    ifrm.setAttribute("src", frmSource); a
    ifrm.style.width = 0 + "px";
    ifrm.style.height = 0 + "px";
    ifrm.setAttribute("frameBorder", "0");
    document.body.appendChild(ifrm);

URLBuilder contains the GET variables to the next page

The issue occurs at document.body.appendChild(ifrm);

and my error is javascript typeerror: null is not an object (evaluating 'document.body.appendchild')

I suspect the issue is it is trying to append the iframe to the body but the body has not properly loaded. I am currently only getting this issue in safari.


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md