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

Inline (or included) JavaScript execution by Chrome #232

Open
jbunds opened this issue Mar 15, 2024 · 1 comment
Open

Inline (or included) JavaScript execution by Chrome #232

jbunds opened this issue Mar 15, 2024 · 1 comment
Labels

Comments

@jbunds
Copy link

jbunds commented Mar 15, 2024

I realize that I am arguably pushing against the boundaries Markdown's design philosophy in terms of reasonable use cases, but is it possible to define some simple JavaScript like the following within a *.md document rendered by the Markdown Viewer extension for Google Chrome:

<script type="text/javascript">
  alert("hello");
</script>

I can see the inline JavaScript is being passed onto Chrome from within the "Elements" tag in Chrome's inspection console, but Chrome does not appear to actually execute it, and I can't figure out why.

Is there perhaps a configuration I missed which will allow Chrome to actually execute the inline (or included) JavaScript?

@simov
Copy link
Owner

simov commented Mar 15, 2024

I think it is because of the underlying framework that I use https://mithril.js.org/trust.html#scripts-that-do-not-run or rather, the fact that it is the default behavior in the browser. Your script tag is being added dynamically after the page has been rendered and therefore the browser ignores it.

@simov simov added the question label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants