Jill Jill - 7 months ago 43
Java Question

Redirect if JavaScript is disabled in JSP itself

I want to redirect if JavaScript is disabled. I am using Servlets and JSPs. My Page redirections are totally in servlets. and i want to check it through jsp and want to redirect to servelet with coditions to get No JavaScript Page.

All other answers were for a fixed url like http://www.example.com/pagename.jsp, but I didn't want to show my .jsp page names anywhere outside the servlet.

Thats why I mentioned that every thing is in servlet controller.


Use this code in your Jsp files.

<meta http-equiv="refresh" content="0.0;url=?action=nojs">

Here "action" is a variable in your servlet which is used for decision taking.

You can change it accordingly.