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.
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.
A clever use of history.replaceState and some special characters (to make it less obvious that the state's been altered) - "view source" in Chrome operates on the currently active URL, which after the replaceState has executed is the "not that easily" page.
You can also reproduce the behavior by navigating back, then forwards again - you'll see the "not that easily" page that way, as well (as the "try and view the source" page has been replaced in your history list).
Just to add to this, the "special characters" are "%E2%80%AE" which is the escaped form of the UTF-8 "Right-To-Left Override" control character (which effectively reverses the display of text).
That's actually not viewing the page source though. That's viewing the current DOM state. If the author was more clever he could have left you a little note to that effect.
In Chrome at least, it also breaks going back to the cached page after first view using back/forward navigation. (Try clicking the link from HN, go "back", then go "forward" again.) This might be obvious to people who know anything about browser caching, but I thought it was kinda interesting.
That shows the current DOM state, not the source that created it. There's a distinction, especially if you use a lot of JavaScript to fiddle with the DOM.
I loaded the page, went to Firebug script panel, set a breakpoint on the line of javascript, hit F5, when the breakpoint got hit, I just hit escape to prevent it from running. Then, Ctrl-U as usual.
Chrome is broken on my machine (proxy issues) so I didn't test there, but I assume the same technique would work.
[+] [-] buro9|14 years ago|reply
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|14 years ago|reply
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.
[+] [-] bri3d|14 years ago|reply
You can also reproduce the behavior by navigating back, then forwards again - you'll see the "not that easily" page that way, as well (as the "try and view the source" page has been replaced in your history list).
[+] [-] adamkhrona|14 years ago|reply
If you try copying the URL to plain-text, you'll see: http://www.kurlak.com/john/%E2%80%AElmth.ecruos
[+] [-] Flam|14 years ago|reply
[+] [-] Zarel|14 years ago|reply
http://citeomatic.com/_asdf.html
(This one only works in Firefox and Opera, not Chrome, sadly)
[+] [-] sedev|14 years ago|reply
[+] [-] dcreemer|14 years ago|reply
[+] [-] chrischen|14 years ago|reply
[+] [-] unknown|14 years ago|reply
[deleted]
[+] [-] marcneuwirth|14 years ago|reply
[+] [-] lengarvey|14 years ago|reply
[+] [-] nikcub|14 years ago|reply
That said, pretty neat trick.
[+] [-] The_Sponge|14 years ago|reply
[+] [-] ngokevin|14 years ago|reply
<html> <head> <title>Source</title> </head> <body> Can you view my source from Chrome or Firefox? </body> </html>
[+] [-] pixeloution|14 years ago|reply
[+] [-] dante_dev|14 years ago|reply
<html><head> <title>Source</title> <meta charset="UTF-8"> <script type="text/javascript"> history.replaceState(null, null, String.fromCharCode(8238) + 'lmth.ecruos'); </script> </head> <body> <p>Can you view my source from Chrome or Firefox?</p>
</body></html>
[+] [-] Intermernet|14 years ago|reply
[deleted]
[+] [-] vrotaru|14 years ago|reply
[+] [-] jvm|14 years ago|reply
[+] [-] DanielRibeiro|14 years ago|reply
[+] [-] nikcub|14 years ago|reply
[+] [-] tantalor|14 years ago|reply
[+] [-] TooEasy|14 years ago|reply
This is on Firefox version 11.0. The creator of this page forgot the Firefox ecosystem has this nifty plug-in called NoScript.
[+] [-] runevault|14 years ago|reply
[+] [-] FaceKicker|14 years ago|reply
[+] [-] Elhana|14 years ago|reply
[+] [-] aespinoza|14 years ago|reply
<!DOCTYPE html> <html> <head> <title>Source</title> <meta charset="UTF-8"> <script type="text/javascript"> history.replaceState(null, null, 'source.html' + String.fromCharCode(8237)); </script> </head> <body> <p>Can you view my source from Chrome?</p> </body> </html>
[+] [-] Brandon0|14 years ago|reply
[+] [-] RugerRedhawk|14 years ago|reply
[+] [-] pjscott|14 years ago|reply
[+] [-] mkopinsky|14 years ago|reply
Chrome is broken on my machine (proxy issues) so I didn't test there, but I assume the same technique would work.
[+] [-] leppie|14 years ago|reply