0

I got a custom HTTP-500 error site from here. (codepen).

In the browser, this works as intended, at least when I'm watching the site at codepen.

When I copy the files to my IIS however, I get the error-message:

Uncaught TypeError: Cannot read property 'children' of null

Most basic example to reproduce on my machine is this:

<!Doctype HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>ASP 500 Error</title>
        <link rel="stylesheet" type="text/css" href="/error/style.css" />
        <script src="/error/error500.js"></script>
    </head>
    <body>
    <div class="stack-container">
        <div class="card-container">
            <div class="perspec" style="--spreaddist: 125px; --scaledist: .75; --vertdist: -25px;">
                <div class="card">
                    <div class="writing">
                        <div class="topbar">
                            <div class="red"></div>
                            <div class="yellow"></div>
                            <div class="green"></div>
                        </div>
                        <div class="code">
                            <ul>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </body>
</html>

Tested in IE and Chrome. Both work on codepen, neither does it locally.

I checked the references to the JS/CSS already and they work. On top of that, I tried to figure out if there are any 3rd party libs involved on codepens site, but it doesn't seem like it.

DasSaffe
  • 2,080
  • 1
  • 28
  • 67
  • 2
    The problem with Codepen is that the JS code that's inside the pens is added after html so it can find the elements. If you want to do the same you need to put JS code at the end or use `window.addEventListener('load', () => { /* your code */ });` or Dom ready event. – jcubic Feb 14 '19 at 14:19
  • You can't access body element until it's declared and your script is running in . Try this: window.onload = function(){ document.body.innerText = 'testje'; }; or place your script below – Jasper Lichte Feb 14 '19 at 15:01

0 Answers0