how to block and unblock popup in javascript?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nirmalsingh
    New Member
    • Sep 2006
    • 218

    how to block and unblock popup in javascript?

    hai all ,
    i need to block and unblock popup by javascript, and it should work in ie and mozilla. how to do this.
    thanx in advance

    with cheers
    -Nirmal
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Do you mean controlling the popup blocker settings of the browser? If so, that's not possible with JavaScript.

    If you want to detect if a popup has been blocked, that should be possible.

    Comment

    • queena
      New Member
      • Jan 2008
      • 1

      #3
      Hi,

      How to detect if a popup has been blocked by javascript? Thanks so much.

      Queena

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Welcome to TSDN!
        Originally posted by queena
        Hi,

        How to detect if a popup has been blocked by javascript? Thanks so much.

        Queena
        When you create the popup using window.open, assign it to a variable and then check if that variable is defined, e.g.:
        [code=javascript]var popup = window.open(... );
        if (!popup) ...[/code]

        Comment

        Working...