Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

well yeah, but why would they want to block out the "orange website"?


I don't think "screw with" means "block" in this case. But there is one moderately famous blog that does block HN: https://www.jwz.org/


yeah I asked jwz how to do that, but I can't figure out a way to make that work with Github pages.


  if (document.referrer === 'https://news.ycombinator.com/')
    window.location = 'https://cdn.jwz.org/images/2016/hn.png'
Or something along those lines should work.


He checks the Referer header[1]. In Firefox you can prevent that header from being sent by setting `network.http.sendRefererHeader` to 0 (in about:config).

[1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Re...


HN helpfully uses the referrer, so you can easily do it with a tiny bit of JS:

    <script>
    if(document.referrer == "https://news.ycombinator.com/") {
        // Mess with HN users here...
    }
    </script>


View source on the linked website just now:

    <!-- DO HN STUFF HERE
    <script>
        if(document.referrer == "https://news.ycombinator.com/") {
             window.location = 'https://bbenchoff.github.io/images/Brogrammers.png'
        }
    </script>
    -->


JWZ appears to use Apache, so he probably does something like http://www.htaccess-guide.com/deny-visitors-by-referrer/


That is the way it was done back in the day, usually when admin wanted guests to not come through Google Search or to come through a correct word-of-mouth bouncer page. Client side JS implementations allow content to be viewed by blocking JS.


They're not blocking it out, they are protesting the weird, variable, "original title" policy. https://news.ycombinator.com/newsguidelines.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: