TypeError in Embed script


Unhandled rejection TypeError: Cannot read properties of null (reading 'EventTarget')
    at Function.w.fixWindow (https://static.runkitcdn.com/assets/window-manager-sha512-RKysXX6Rsagw6TBIGGT2BF51ikYcA8wYL8TZoBVUDeziI0y3YWu32miMcqBscoUEHacKetWBYPoc8SucpUAiHg==.bundle.js:14843:352)

Relevant code:

<script type="text/javascript" src="https://embed.runkit.com" data-element-id="runkit"></script>
              <pre id="runkit">
const Cite = require('citation-js')

const data = await Cite.async('Q30000000')

data.format('bibliography', {
  format: 'html',
  template: 'apa',
  lang: 'en-US'

Interesting, would it be possible for you to share a link to the page you get this error? Or if not maybe a GitHub gist with the some HTML that reproduces the error?

Of course, https://citation.js.org/

It seems to work fine when I run it in localhost. Maybe it’s a GitHub security directive thing or something?

Thank you, this is very helpful. Not sure why yet but it seems to work fine in Safari but not Chrome or Firefox. For whatever reason when we try to access an element’s window, it’s not set.

It’s interesting that you were are able to get it to work on localhost, I wasn’t unfortunately. But I was able to if I comment out the script tag for https://code.getmdl.io/1.3.0/material.min.js, then it works.

This is very strange, indeed.

Ah okay, I probably had removed material.js at that point already. Interesting that that was causing a problem, I don’t remember it doing so before. But I am not going to use it anymore I don’t think, so that should be fine now on my end at least. Thank you!