javascript enabled check?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

javascript enabled check?

Post by lc »

Okie I was thinking about this and well... can't figure it out yet.

I want to use javascript layers in a new sitedesign I'm working on and well.. when people (those few idiots) have java switched off, the site gets completely messed up.

How would you make a layer only print out when people have java enabled.

Basicly I am using php to set the layer properties and content already and well it would be easy enough to just put that inside a:
if ($java == "yes"){ } thing. But can you use java to set that variable... I'm sure you can but it's client side... thus only gets processed after the php which would make that point mute.

Basicly I am saying.. can php check for java somehow... and without GET_BROWSER since my host hasn't got it installed.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Just put content for non-javascript users into <noscript> tags:

Code: Select all

<noscript>Here's content for those people using text-to-speech readers and other browsers that can't understand javascript. I (lc) understand that you are not idiots and may have very good reasons for not having javascript enabled and have accordingly made my site more accessible by using <noscript> tags.</noscript>
and any scripts into comments so that browsers that don't understand javascript don't try to do anything with it:

Code: Select all

<script language="JavaScript">
<!-- Hide code from older browsers
lots of lovely page bloating javascript
//-->
</script>
Mac
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

Post by lc »

okie twiglet ;)

Thx I think the comments thing may well do it for me. I'll try it out.
CodeEye
Forum Commoner
Posts: 25
Joined: Fri Jul 05, 2002 7:19 am

Post by CodeEye »

you could also manualy create the layer using dom but you would need a dom browser this is how i have done it on my site that i am developing
Post Reply