How to test whether the JavaScript is enabled or not? (XPages)

Is there some advice how to test whether the JavaScript is enabled or not in the client browser? Redirection to specific XPages for users with disabled JavaScript would be perfect ;?)

Subject: XPage markup itself isn’t needed

I’m not entirely sure if this works cross-browser, as the version I wrote just displays a statement rather than redirecting them (I didn’t want to redirect them elsewhere as there was other important information on our first page), so you’ll need to test it for that.

As you can add straight HTML to the source of your Xpage, the following should do what you need:

Subject: It works - thanks a lot

I tested your solution with: FireFox, Chromium, IE7, IE8, Konqueror, Opera - works well.BTW - which way do you display a statement?

Subject: Glad to hear it :slight_smile:

At the time we unfortunately didn’t have the timescale to implement anything really elegant, so ours is essentially a paragraph stating that their javascript is off (in red naturally) and that the Xpage area will not work correctly without it enabled. It also contained a link to open up the relevant help page that had instructios on how to enable it for all browsers.

The meta tag in the previous code posted is essentially replaced with a paragraph tag containing this information (the section between the noscript tags is treated like normal html, the noscript tags render the enclosed html only when javascript is disabled.).

Like I said, not elegant. When I get a block of time form work to make things a bit nicer, this will be one of those areas I’ll be refining :slight_smile:

Subject: Re: Glad to hear it :slight_smile:

Thanks for explanation. I’m feeling redirection more suitable for centralization and maintenance purpose nevertheless I’ll be glad if you share your future research results ;?)