3 ms·
I hit F12 in Chromium, dev tools open with the tree, knowing that I'm viewing the DOM and not the source I hit the Resources tab, and there is the source. Not
by buro9 15y ago
I hit F12 in Chromium, dev tools open with the tree, knowing that I'm viewing the DOM and not the source I hit the Resources tab, and there is the source.
Not a problem at all.
In fact, I had to remember to go back to right clicking and View Source to try and figure out why this was so highly ranked and lots of the comments confused me.
Now I see why... but just like using JavaScript to try and detect right click, using replace state to try and obscure the source isn't likely to be effective in any reasonable way. I guess that's not the point, that this is more fun than anything someone will do, except... I bet someone does it on their live site.
- dazbradbury 15y ago> I bet someone does it on their live site. I doubt it, as this method breaks forward/back functionality, thus probably breaking most sites. Having said that, for all links, you could do a further re-write using the history API, before allowing the redirect to take place. I guess that would actually make it usable even if, as you say, it's futile in the end.
- Drbble 15y agoMany sites (hi, Twitter; #! you, too!) happily break the back button. It is a standard technique to "boost" engagement and "reduce" bounce rate. Seems spiritually inline line with this view-source gimmick.
- dazbradbury 15y agoWell, it's not really the same. On Twitter if I'm viewing an individual tweet page, and then click onto the authors profile page, and then click "back" in my browser, I will not be redirected to a different page altogether like in the OP's demo.
- dlikhten 15y agoThere is a problem, of course. Going to the new url fails to render the site, so view source won't work but neither will bookmarks. And you DON'T want to prevent bookmarking. But good to know this works.