Show HN: Disabling View Source in Firefox and Edge (no-source.github.io) 6 points by JeremyBanks 8y ago ↗ HN
[–] inceptionnames 8y ago ↗ Neat. How do people even discover a hack like this? [–] JeremyBanks 8y ago ↗ In this case, I was trying to use `document.open()` to replace the document with some text for debugging, and I noticed some strange side effects. :) The starting point was here: https://stackoverflow.com/questions/39233344/does-javascript...
[–] JeremyBanks 8y ago ↗ In this case, I was trying to use `document.open()` to replace the document with some text for debugging, and I noticed some strange side effects. :) The starting point was here: https://stackoverflow.com/questions/39233344/does-javascript...
[–] core-questions 8y ago ↗ For the lazy, here's the magic: <script> document.currentScript.remove(); setTimeout(function() { // no rights reserved (BSD0) by Jeremy Banks <_@jeremy.ca> const html = document.documentElement.outerHTML; document.open('text/plain'); document.write('view source disabled'); document.close(); document.documentElement.innerHTML = html; }); </script>
[–] clouddrover 8y ago ↗ When I view source in Firefox I get the URL "view-source:wyciwyg://0/https://no-source.github.io/" which gives me the "view source disabled" message.But if I then manually edit that in the location bar to "view-source:https://no-source.github.io/" I can view the source as expected.
5 comments
[ 1.7 ms ] story [ 21.4 ms ] threadBut if I then manually edit that in the location bar to "view-source:https://no-source.github.io/" I can view the source as expected.