Jump to content

Recommended Posts

Hi guys -

 

I'm looking for a way to detect whether or not a browser has JavaScript enabled using php, rather than the client-side <noscript> tag...  I intend to have an alert bar show up at the top of my page only if JavaScript is disabled, or if I want to make an announcement (In the latter example, noscript wouldn't work).  There's also the possibility of showing both messages at the same time.  Any ideas?

 

If something similar to this has already been posted (I didn't find it), please redirect me...

Link to comment
https://forums.phpfreaks.com/topic/53919-php-alternative-to/
Share on other sites

As others have rightly pointed out - php can't detect if javascript is enabled or not.

 

What you can do though (if you are ok with the banner only showing on any page AFTER the firts page the user visits) use javascript to add a variable to the end of each link OR alter the value of any submit buttons - in the processing script you could look fro these - if they are present then js 'is' on. (I say 'is' as someone could put this in themselves but theyed have to really want to...)

Link to comment
https://forums.phpfreaks.com/topic/53919-php-alternative-to/#findComment-266632
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.