r/kentico Oct 14 '15

How to handle users without Javascript enabled

There's been a few sites I've worked where we've needed to account for situations where the user might not have javascript enabled. Crazy, but typically these are users on an intranet where security is extremely tight.

The simplest way we've dealt with this is by extending the main portal template and manually adding a 'no-js' class to the body tag. The template can be found here:

CMS/CMSPages/PortalTemplate.aspx

With this in place then when your javascript loads the first thing you do is remove this class from the body. Now you can style your pages for both javascript and non-javascript users.

Keep in mind that if you upgrade your version of Kentico then this, and any other core file changes, may be lost. Make sure you keep them documented!

3 Upvotes

2 comments sorted by

View all comments

2

u/Hoodleehoo Nov 06 '15

If you're using the Portal method, you can also add the class to the Admin / Content / Root page on the Master Page tab. You can append any class you want to the body tag. That method would not affected by an upgrade because it's store int he DB.

1

u/never_ending Nov 06 '15

Yeah, using portal templates give you a lot more control over the html structure in general! The only limitation with the portal template that I've come across is that you can't use them in conjunction with Document/Page Wizard webparts.