5

Possible Duplicate:
What HTML tags are allowed on Stack Overflow, Server Fault, and Super User?

I'm inserting the following script into my post, which is removed when shown. How did this happen?

<script>alert('hi');</script>
  • 1
    I don't agree it should have been migrated, this is programming related. Anyway, the answer is here: meta.stackexchange.com/questions/1777/… – Kobi Nov 25 '09 at 7:59
  • Being that you've been a member for two months, you should know how the site works and how to format code. Well, the hope is. – random Nov 25 '09 at 8:00
  • But without any context or content in the question, there's no telling if they want to know how to replicate (SO) or wanted to know if that's how SO works (Meta). – random Nov 25 '09 at 8:01
  • 1
    Of course, the question is terrible. But it was migrated before a change to clarify that point. – Kobi Nov 25 '09 at 8:02
5

<Should be on MSO>

The post-handling code for SO uses some sort of processing on the text that removes most of the HTML, thus removing the script part. If it didn't you could do something like the following:

<script>
call_some_function_that_buffer_overflows("codethatexplodestheusersmachine");
</script>
| improve this answer | |
3

By removing the tags in the appropriate place. It's called "preparing your data for the appropriate context".

| improve this answer | |
1

First of all it's not inside the script tag. Even if you put it in the script tag it gets converted to corresponding HTML entities.

For example,

<script>
    alert("Hello");
</script>

The above code gets converted using following lookup table.

< --> &lt;
> --> &gt;
" --> &quot;
| improve this answer | |
  • But, that's not what you see on the question... – Kobi Nov 25 '09 at 7:55
  • no problem it will be useful to him – Xinus Nov 25 '09 at 8:07