The document you linked says it doesn't make it safe to use, but rather helps in fixing syntax errors.
" escapejs Escapes characters for use in JavaScript strings. This does not make the string safe for use in HTML, but does protect you from syntax errors when using templates to generate JavaScript/JSON." And there is also the CSS context, using things like expression which can execute JavaScript. I'm just saying it will be great to have filtering context for those On May 3, 2012 6:34 PM, "Tom Evans" <tevans...@googlemail.com> wrote: > On Fri, Apr 27, 2012 at 11:58 PM, Voulnet <voul...@gmail.com> wrote: > > Hello provides great protection from XSS by escaping output to > > webpages, but it only does it in HTML context. XSS can be executed > > when user input is inserted into javascript or CSS, which have > > different context and rules than HTML, so HTML context escaping > > doesn't help/protect. > > > > Are there any remote chance of django escaping extending to other > > contexts beside HTML? > > > > There is the built-in escapejs filter that works fine for making user > generated content safe. > > https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#escapejs > > Although it would be nice to be able to alter the escaping algorithm > in use, so that one can do things like this: > > {% block head %} > <link rel="stylesheet" .../> > <script type="..."> > {% autoescape javascript %} > var user = '{{ user.name }}'; > {% endautoescape %} > </script> > {% endblock %} > > Cheers > > Tom > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.