Open bradcarter1994 opened 1 year ago
Adding a little more context here. I'm a backend Scala developer and I use Scastie to embed code snippets in my dev blog, which is a super cool feature. A couple of weeks ago, I noticed that the Scastie snippets weren't rendering in my blog.
I've been digging into the issue, but front end development is unfamiliar territory for me and I will gladly take any help that anyone can offer with the problem.
What I've found so far:
document.write
can cause performance issues, and that they may sometimes block content that is synchronously loaded over slower connections. However, the blog page also explains that Chrome will not block the content on a reload, which is still happening here. Additionally, this doesn't explain why the issue is also happing in browsers other than Chrome. I suspect that this may be a related issue, but probably isn't the root cause.defer
/async
to the script tag. I tried this, but it results in the error message Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
It looks like there's already an open issue for this here.Hey, thanks for reporting! I think this may be the only issue on your side. I've just tried embedding the Scastie in CodePen, locally, and it seems to work. If you check https://tourofscala.com/scala/list-sum-method, it is also using embedded one and it is loading as intended. Maybe it is blocked for some reason? Can you try using your mobile network / phone / other computer and try reproducing it? What is the status of the request?
Hi, thanks for getting back so quickly. That's really good to hear that it's not broken everywhere, but I'm now significantly more confused than I was yesterday.
The two sites I'm looking at that use embedded Scasties are OlegYch's CodePen that's linked to in the embedding section of the project Readme and my own blog.
Both of those pages are broken on my macbook on Chrome, Safari, and Firefox and on my PC on Chrome, Edge, and Firefox. Additionally, a co-worker in a different timezone messaged me that my blog was broken for them too (which is how I found out about the issue.)
That being said, the tourofscala page that you linked to is working for me on both my mac and PC. (I noticed though that Scastie component on that page isn't being loaded immediately, that you have to click Load Exercise to get it to appear, and I wonder if that's what's making the difference.) By chance, do you know of any other sites that use embedded scasties that we can check as well?
Also, can you check if Oleg's Codepen and my blog are broken for you too?
Describe the bug
Scastie's embedding feature is broken in all major browsers
Scastie snippet link
https://scastie.scala-lang.org/UVDHguSaRTCQz9pz8SGFJw
To Reproduce
Expected behavior
The embedded Scastie window should be rendering, but isn't
Screenshot ( Optional )
Version
Embedded Scastie
What browsers are you seeing the problem on?
Firefox, Chrome, Safari, Microsoft Edge
Relevant log output