Ezilon.com - Target Your Audience, be Seen in Your Region

check if Javascript is enabled and take actions

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

They have: 53 posts

Joined: Oct 2005

Hi,
I want to add a couple of pop-up boxes in my page, and I want to know :
1) is there a small piece of code that I must paste in my page which will check to see if the client has JS enabled?
2) do I use the tag to enter the page that the user with no JS enabled will see?
3) if a user has JS enabled, do I need to check also if there are pop-up blockers, or it will be ok and my pop-up will open with no problem?

What I want basically is:
I have a link in the page ,which, if JS is enabled will open in a pop-up window when the user clicks on it, whereas, if JS is disabled, it will open in a new page, like plain, ordinary links

Thanks in advance

Busy's picture
Modrater

He has: 6,157 posts

Joined: May 2001

You can't test if javascript is enabled, well you could if you used cookies etc but you need a refresh or something to set and retrieve it.
You can't test if person has pop up blocker, even if you could you'd need at least 10 different checks as there are so many different programs blocking them these days.

just write your code as normal and then again without javascript in tags, you can turn javascript off and on real easy by going to tools/options in your browsers tool bar. Also you may want to check it in at least 3 browsers - IE, Mozilla (firefox) and Opera. All 3 can trick the web page into thinking they are IE but do things differently.

<?bhb if(broken){ echo("It wasn't me Smiling "); } ?>
Learn HTML the ez way - EzHTML.net

Some people are like slinkies, they dont really serve any purpose but they still bring a smile to your face when you push them down the stairs ...