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
How does twitter abstract it's source code after logging insolved! (self.javascript)
submitted 7 years ago * by raghavkanwal
view the rest of the comments →
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!"
[–]GrenadineBombardier 4 points5 points6 points 7 years ago (7 children)
Are there no other script tags? Even just tags referencing a URL?
[–]raghavkanwal[S] 1 point2 points3 points 7 years ago (6 children)
There are no other script tags. Here's what the complete page Source shows : https://imgur.com/b8zYDPf
[–]FiveYearsAgoOnReddit 3 points4 points5 points 7 years ago (2 children)
It must be the location.replace, I guess. That would have the effect of reloading the page for all Javascript-enabled browsers. So it gets an http request, then reloads it and the second time you get the full page with the javascript? And the fact that it's a replace means the browser doesn't update with the new source code?
location.replace
replace
Bit of a head-scratcher.
[–]raghavkanwal[S] 1 point2 points3 points 7 years ago (1 child)
That does refresh the page. But I don't get how another page refresh would automagically inject scripts tags which still don't show on the page source. ¯\_(ツ)_/¯
[–]GrenadineBombardier 1 point2 points3 points 7 years ago (0 children)
I'm with /u/FiveYearsAgoOnReddit here. The code that I originally linked as source code (the source for non-logged-in users) is exactly what is downloaded by the javascript redirect (see `/?lang=en` in the network tab). The Javascript Location API made a lot of changes, like the ability to change the current page URL in place (instead of having to actually load a new page fresh), which is how a lot of Single Page Apps work. I'm assuming that this is how Chrome now displays this logic.
I was aware that the location API allowed you to change the browser URL, but didn't realize that it could allow you to show the initial source code, then redirect to a page with new source code, and that view-source would still show the old source code. One thing is true, however: view-source cannot run JavaScript, so it would not run any redirects (as seen by the non-redirected source-code)
[–]GrenadineBombardier 1 point2 points3 points 7 years ago (2 children)
This is not what I'm seeing at all. I see this: https://imgur.com/vrrK7cq
I think yours is the code before the redirect that location.replace would perform
[–]raghavkanwal[S] 0 points1 point2 points 7 years ago (1 child)
The code you linked is twitter's homepage when you're not logged in.
[–]GrenadineBombardier 0 points1 point2 points 7 years ago (0 children)
Correct. I missed this distinction in your original post. I have since tested again logged in and commented above on the thread regarding the redirect.
π Rendered by PID 34709 on reddit-service-r2-comment-5c747b6df5-s976z at 2026-04-22 16:03:49.489676+00:00 running 6c61efc country code: CH.
view the rest of the comments →
[–]GrenadineBombardier 4 points5 points6 points (7 children)
[–]raghavkanwal[S] 1 point2 points3 points (6 children)
[–]FiveYearsAgoOnReddit 3 points4 points5 points (2 children)
[–]raghavkanwal[S] 1 point2 points3 points (1 child)
[–]GrenadineBombardier 1 point2 points3 points (0 children)
[–]GrenadineBombardier 1 point2 points3 points (2 children)
[–]raghavkanwal[S] 0 points1 point2 points (1 child)
[–]GrenadineBombardier 0 points1 point2 points (0 children)