Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

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

Open
iansv opened this issue Sep 19, 2018 · 1 comment

Comments

@iansv
Copy link

iansv commented Sep 19, 2018

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?

@RonaldPK
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants