3 ms·
Chrome is actually adding a feature that lets school admins disable view source because school test pages had the answers in the source.
by Gigachad 5y ago
Chrome is actually adding a feature that lets school admins disable view source because school test pages had the answers in the source.
- karlding 5y agoEnterprise-level Chromium removes view-source to prevent students from cheating [0]. [0] https://news.ycombinator.com/item?id=29211611 https://news.ycombinator.com/item?id=29211611
- speedgoose 5y agoCan you still write something like javascript:alert(document.body.parentNode.innerHTML) in the address bar and press enter?
- tzs 5y agodocument.documentElement.innerHTML might be better than document.body.parentNode.innerHTML. The latter fails if there is no body element, e.g. when the page is an SVG document. If you want a closer approximation of the full source, outerHTML might also be better. I've also seen "new XMLSerializer().serializeToString(document)" suggested. That seems to give the most complete source, but I've also read that it might have problems with things that need escaping. I have no experience with that approach because for what I needed the first thing I found when Googling, document.documentElement.innerHTML, gave me what I needed. One more thing to consider. All of the above I'd expect give you source that would produce the currently displayed page including any modifications that were made after loading by JavaScript (which is probably what you'd want for cheating on a test so is fine). I'm not sure that is the same as what "view source" gives--does it give the current page or the page as it came over the wire?