add-to-homescreen icon indicating copy to clipboard operation
add-to-homescreen copied to clipboard

Uncaught TypeError: Cannot read property 'appendChild' of null (addtohomescreen.js:553)

Open iansv opened this issue 6 years ago • 1 comments

There is an error on this line: // attach all elements to the DOM this.viewport.appendChild(this.element); this.container.appendChild(this.viewport); Does anybody know how to fix it?

iansv avatar Sep 19 '18 11:09 iansv

I ran into that too. this.container is supposed to refer to document.body, but when it is being defined (on line 279) the document hasn't finished loading yet so document.body is still null.

I "fixed" it by adding

if (this.container == null) this.container = document.body;

to line 451 (where DOM and document are ready). Ugly, but it works.

RonaldPK avatar Nov 28 '18 17:11 RonaldPK