Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: null is not an object (evaluating 'document.body.insertBefore') #8

Open
matiasmacera opened this issue Jun 23, 2019 · 2 comments

Comments

@matiasmacera
Copy link

Im getting this error when trying to add the script

TypeError: null is not an object (evaluating 'document.body.insertBefore')

@youcanping
Copy link

script in body is OK

@sandoche
Copy link
Owner

Try loading the library with a function on window's load:

  function addDarkmodeWidget() {
    new Darkmode().showWidget();
  }
  window.addEventListener('load', addDarkmodeWidget);

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

No branches or pull requests

3 participants