check if Javascript is enabled and take actions

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

He has: 6,151 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.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.