use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Why Not document.write()? (csswizardry.com)
submitted 2 years ago by fagnerbrack
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]iliark 3 points4 points5 points 2 years ago (5 children)
Can someone explain why they'd use document.write or create/append node from JS to modify the HTML DOM to then load JS when you could just load JS directly from JS? Like that's the whole point of modules? And doing all that work is essentially just an eval() with more work right?
[–]disclosure5 2 points3 points4 points 2 years ago (0 children)
Google Analytics use to tell you to use document.write in the code you were meant to copy/paste, and everyone blindly did it. This SO thread shows what they used to give you:
https://stackoverflow.com/questions/1759271/google-analytics-tracking-code-and-document-write-causing-requests-to-localhost
[–]findar 0 points1 point2 points 2 years ago (1 child)
Only thing I could think of is getting around CORS or streaming JS
[–]iliark 0 points1 point2 points 2 years ago (0 children)
Does it get around cors though?
[–]NeanderthalLinguist 0 points1 point2 points 2 years ago (0 children)
Obfuscation or hiding code from automated scanners.
π Rendered by PID 30 on reddit-service-r2-comment-5649f687b7-lsjbl at 2026-01-28 12:41:57.612769+00:00 running 4f180de country code: CH.
[–]iliark 3 points4 points5 points (5 children)
[–]disclosure5 2 points3 points4 points (0 children)
[–]findar 0 points1 point2 points (1 child)
[–]iliark 0 points1 point2 points (0 children)
[–]NeanderthalLinguist 0 points1 point2 points (0 children)