check if Javascript is enabled and act accordingly

Discussion in 'JavaScript' started by ktsirig, Apr 11, 2006.

  1. #1
    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 <noscript> 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
     
    ktsirig, Apr 11, 2006 IP
  2. Slapyo

    Slapyo Well-Known Member

    Messages:
    266
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Just have the javascript with some <noscript> tags for people who don't have it turned on. I am not sure if you can check for blockers, but you may or may not have problems with pop-ups from javascript.
     
    Slapyo, Apr 12, 2006 IP
  3. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try something like this: make sure your popup function returns false.
    
    <a href="popup_alternative_page.html" onclick="do_the_popup();">Somethign</a>
    Code (markup):
     
    exam, Apr 17, 2006 IP