Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

accessibility - how to find if javascript is enabled?

Featured Replies

Hey,

 

Designing a new site with a few jazzy Ajax effects (scrollers and such) but ofcourse i'm trying to make this as accessible as possible.

 

i want to discover if the users browser has javascript enabled, and if not use PHP to manipulate a few css attributes on load to compensate for the javascript.

 

researching this on the www suggests the easiest option is to use a javascript re-direct on load to redirect to the javascript rich page if it is enabled, and if not obviously it will stay on the non JS page.

 

this seems a bit of a long way round and on top of that apparently effects google performance. :(

 

 

is it at all possible to either check a variable with PHP that has been set using javascript, or check an elements class using PHP?

i could then use this to check against using PHP and determine if javascript is enabled, and stop the changes to the page.

 

or is there a more standard method for doing this?

 

Thanks,

 

Dean

Hi there, it seems to me that you're looking at this from the wrong angle.

Ideally, you should build the page first without using any javascript functionality at all. Only then should you start to add javascript to the page, introducing effects, manipulating the DOM, adding classes etc.

This way, users without js get a working, functional site and users with js get the swish extras.

Doing it this way means there is no need to check if js is enabled.

Hope that helps :)

  • Author

Thanks Elan man, that kind of helps and doesn't help at the same time :s

 

i understand exactly where you're coming from, and of course it should always be the way sites are made.

sorry i think i've worded my last post a bit wrong (it was 1:30am after all :p).

 

my site is fully accessible and usable for people who do not have javascript enabled. All the content can be reached perfectly well without the swishy effects. but because of the sections the effects are being used in, slide bars are required, which doesn't look quite as aesthetically pleasing, as if they weren't there.

 

I know, I know, some people are going to say 'why don't you re-design the site so it looks good with them, that way you don't have to worry either way.'

 

but it would be nice to be able to do it both ways, and still not be compromised, kind of a have my cake and eat it scenario. It's my site, why shouldn't i after all? :D

  • Author
Hi there, it seems to me that you're looking at this from the wrong angle.

Ideally, you should build the page first without using any javascript functionality at all. Only then should you start to add javascript to the page, introducing effects, manipulating the DOM, adding classes etc.

This way, users without js get a working, functional site and users with js get the swish extras.

Doing it this way means there is no need to check if js is enabled.

Hope that helps :)

 

 

found a simple solution to my problem :)

 

added a class of 'js-disabled' to the elements using javascript in the written HTML. This displays the page as fully accessible to people who have javascript turned off.

 

Then made a script that runs on document ready that cycles through all elements with the class of js-disabled and replace it with a class of js-enabled that has the styles for the javascript elements.

 

people without get to see all the content nicely, and for those lucky people with javascript enabled they get the extra swishy effects. :D

  • Author
let's see it then!

 

 

www.deanpuckett.co.uk/portfolio

 

i've even made it so that if javascript is turned off people can still click links to zoom to the content without even needing scroll, but still have the option to.

 

just finished putting the final touches to it. any comments let me know :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.