Live data from Hacker News

Firefox and IE's "View source" can be spoofed to show anything

scriptjunkie.us

1–10 of 43 posts

Re: Firefox and IE's "View source" can be spoofed to show anything

#5

Thankfully, curl can't be tricked in such a manner. I'd have a more substantial comment, I hope, if the site was loading.

Yep. Sounds interesting but seems like it's meta-comments only at this stage.

If anyone happens to load this elusive "View Source Spoof" page, please leave a nice detailed description for the rest of us.

Our minds can draw the pictures :)

Re: Firefox and IE's "View source" can be spoofed to show anything

#6
post #5

Thankfully, curl can't be tricked in such a manner. I'd have a more substantial comment, I hope, if the site was loading.

Yep. Sounds interesting but seems like it's meta-comments only at this stage. If anyone happens to load this elusive "View Source Spoof" page, please leave a nice detailed description for the rest of us. Our minds can draw the pictures :)

Cache (no images):

https://webcache.googleusercontent.com/search?q=cache:http:/...

Re: Firefox and IE's "View source" can be spoofed to show anything

#8
post #7

Since the site seems to be down, you can read the article (no images unfortunately) in Google's Cache[1]. [1]: https://webcache.googleusercontent.com/search?q=cache:http:/...

I've recreated a simple proof of concept here: http://taskthere.com/viewsource/

It works in Firefox 6, not sure about any other browsers. If you want to see the actual source, disable JavaScript (or use Chrome or curl).

Re: Firefox and IE's "View source" can be spoofed to show anything

#9
Hmm, I can't reproduce what he claims by only looking at the cached version without images and source code.

I especially don't understand this part:

  When you use document.write outside of a script tag embedded inline in
  the page [...]
What is "outside of a script tag embedded inline in the page" supposed to mean?

Re: Firefox and IE's "View source" can be spoofed to show anything

#10
post #9

Hmm, I can't reproduce what he claims by only looking at the cached version without images and source code. I especially don't understand this part: When you use document.write outside of a script tag embedded inline in the page [...] What is "outside of a script tag embedded inline in the page" supposed to mean?

What that means (though is not how I would word it) is a document.write that is called asynchronously. The post uses an ajax request to do it but I've recreated it here [1] like this:

    setTimeout(function() {
      document.write('foo');
      document.close();
    }, 1);
[1] http://taskthere.com/viewsource/
Post reply on HN