content icon indicating copy to clipboard operation
content copied to clipboard

Example reload is broken

Open skyfighteer opened this issue 4 weeks ago • 3 comments

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM

What specific section or headline is this issue about?

First example under "Encapsulation from JavaScript"

What information was incorrect, unhelpful, or incomplete?

Open the example. The "reload" button is broke, returns 403 error in console and breaks the page. The next example's "reload" button is the same when opened on the playground, but it does work embedded in the MDN page.

What did you expect to see?

A working reset button

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

skyfighteer avatar Dec 16 '25 17:12 skyfighteer

The MDN Playground (mdnplay.dev) uses single-use, signed runner URLs, and navigation APIs like location.reload() are intentionally blocked. As a result, the Reload button will always trigger a 403 in the playground. Since a real page reload cannot work in this environment, the most correct fix would be to remove the Reload button (or replace it with a simulated reset) so the example doesn’t demonstrate behavior that the runner cannot support.

laxitajain avatar Dec 16 '25 18:12 laxitajain

Being able to easily reset live samples is an important requirement for MDN content, and this method is widely used and even recommended in the meta-docs. It would be better still if live samples had some native way to do reset, as asked for in https://github.com/orgs/mdn/discussions/215, but implementing it in the example is the workaround.

Removing reset from examples like this one is a content regression, and I don't think we could call it a correct fix.

wbamberg avatar Dec 16 '25 19:12 wbamberg

There should be a native solution to this. There is already a "reset" button in the example UI, but i'm not sure what it's supposed to do.

skyfighteer avatar Dec 16 '25 19:12 skyfighteer