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

How to run JavaScript in browser? #1088

Open
MarkLyck opened this issue May 19, 2021 · 0 comments
Open

How to run JavaScript in browser? #1088

MarkLyck opened this issue May 19, 2021 · 0 comments

Comments

@MarkLyck
Copy link

I'm setting up a dead simple page using Charge (love it btw.)

It's just a page telling the user they are blocked. But I need to display the URL that they are trying to access.

Normally I'd just use window.location for this. But when it's rendered server side there is no window.

And since no React is ever run in the browser, it never runs my line of JavaScript.

I tried creating another js file and importing it hoping it would get served with the HTML. But no :(

How do I serve a simple piece of JavaScript in the browser with Charge?

I'm even okay if it means adding a script tag to the React code, but that doesn't seem to work either :(

@MarkLyck MarkLyck changed the title How to run 1 line of JavaScript in browser? How to run JavaScript in browser? May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant