CodeIgniter Forums
TIP: Keep javascript document.write out of your form posts. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: TIP: Keep javascript document.write out of your form posts. (/showthread.php?tid=6418)



TIP: Keep javascript document.write out of your form posts. - El Forum - 02-26-2008

[eluser]MrBaseball34[/eluser]
Found on Experts-Exchange:

To keep javascript injections out of your form posts.

If you're not using document.write yourself (why would you?) you can do this
at the very top of your documents (or as soon as possible):


<script>document.write = document.writeln = function(){};</script>

This will make document.write/ln do absolutely nothing! Ha ha ha!

Or, if you need to use document.write, do this instead:


<script>
document.myWrite = document.writeln;
document.write = document.writeln = function(){};
document.myWrite('See!')
</script>


TIP: Keep javascript document.write out of your form posts. - El Forum - 02-26-2008

[eluser]xwero[/eluser]
use an html entity in the word that has been removed. The CI forum doesn't like javascript code Smile


TIP: Keep javascript document.write out of your form posts. - El Forum - 02-26-2008

[eluser]MrBaseball34[/eluser]
Thanks, I didn't notice that in the preview.