Is there a way in Django (preferably in a view) to check if the user has Java开发者_开发技巧Script turned on?
I need to display a very different page if a user has JavaScript than if they don't.
Thanks
I need to display a very different page if a user has JavaScript than if they don't.
No, you really don't. What you need to do is to make your page work without Javascript, but then enhance it for those people with Javascript turned on. There should be no reason to display a completely different page.
In any case, there isn't a good way of detecting from the server side what the client has enabled. One way of doing it is to serve the non-Javascript page by default, but have a single script that redirects to the other page. But this is pretty horrible, since it means a double page load for most people. As I said, there shouldn't be any reason to do this.
You can not do such a thing. You can only detect it from the client side.
You can follow Daniel's advice (recommended) or use big tags that are active only when JS is not.
精彩评论