4 ms·
yeah I asked jwz how to do that, but I can't figure out a way to make that work with Github pages.
by wanderingjew 5y ago
yeah I asked jwz how to do that, but I can't figure out a way to make that work with Github pages.
- Beltalowda 5y agoif (document.referrer === 'https://news.ycombinator.com/') window.location = 'https://cdn.jwz.org/images/2016/hn.png' Or something along those lines should work.
- shakna 5y agoHN 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>
- vidarh 5y agoView 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> -->
- bryanlarsen 5y agoJWZ appears to use Apache, so he probably does something like http://www.htaccess-guide.com/deny-visitors-by-referrer/ http://www.htaccess-guide.com/deny-visitors-by-referrer/
- numpad0 5y agoThat 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.
- demindiro 5y agoHe 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/Referer https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Re...