popup blocker blocks javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yisehaq
    New Member
    • Feb 2007
    • 8

    popup blocker blocks javascript

    Hi guys

    I am trying to prepare few html pages which contain OLAP cubes on a CD. The problem I have is that the popup blocker blocks the OLAP modules from being shown. Therefore, I wanted to write script that will check if the popup blocker is enabled and tell the user to allow the site. I tried my own scripts and after several tries I looked for better scripts on the web. I ended up with this one but the problem is the same.
    [HTML]<script type="text/javascript" language="JavaS cript">
    <!--

    function detectPopupBloc ker() {
    var myTest = window.open("ab out:blank",""," directories=no, height=100,widt h=100,menubar=n o,res izable=no,scrol lbars=no,status =no,titlebar=no ,top= 0,location=no") ;
    if (!myTest) {
    alert("A popup blocker was detected.Please allow this program to continue.");
    } else {
    myTest.close();
    alert("No popup blocker was detected.");
    }
    }
    window.onload = detectPopupBloc ker;
    //-->
    </script>[/HTML]

    the JAVASCRIPT DOESN"T RUN WHEN THE POPUP BLOCKER IS ON. Therefore, it is not able to tell the user to allow the site. But the script works perfectly it the blocker is off! its show the message there is no popup blocker.(What's the use!). When the popup blocker is on, even a simple alert('Test!') doesn't run. Please Helpppppppppppp .
    The other related question I have, Can I allow all the CD to be allowed by the popup bloker rather than on a page basis.
    Hope to find the solution
    Yisehaq
    Last edited by acoder; Feb 14 '07, 10:09 AM. Reason: test message altered + code in tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Use the other way round, i.e. test for myTest, e.g. try the following:
    Code:
    function detectPopupBlocker() {
    var myTest = window.open("about:blank","","directories=no,height=100,width=100,menubar=no,res   izable=no,scrollbars=no,status=no,titlebar=no,top=   0,location=no");
    if (myTest) {
    myTest.close();
    alert("No popup blocker was detected.");
    } else {
    alert("A popup blocker was detected.Please allow this program to continue.");
    }
    }
    window.onload = detectPopupBlocker;
    This works in Firefox.

    Comment

    • Yisehaq
      New Member
      • Feb 2007
      • 8

      #3
      thanks
      but it doesn't work either. It's not only this script that doesn't work. Even a simple alert() kept at the head tag doesn't work. But when I open the script on the site I took from works. Not on my pages?!!!

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Create a dummy page which only contains simple Javascript. Does it work? If not, you may need to check your browser settings. If it does work, there is a problem with the code on your page.

        Comment

        • Yisehaq
          New Member
          • Feb 2007
          • 8

          #5
          Originally posted by acoder
          Create a dummy page which only contains simple Javascript. Does it work? If not, you may need to check your browser settings. If it does work, there is a problem with the code on your page.
          The script works when the popup blocker is disabled or the page/file is allowed. Otherwise, it doesn't ?

          Comment

          • Yisehaq
            New Member
            • Feb 2007
            • 8

            #6
            Originally posted by Yisehaq
            The script works when the popup blocker is disabled or the page/file is allowed. Otherwise, it doesn't ?
            okay now I found something. the browses "Allow active content to run in files on My Computer" was not clicked when I select that the script will run.

            Now my problem is that I am going to run the pages from CD. Can I make a prompt to the user to modify this without going through all the menus.

            I check on other application CD and it has prompt that asking you to modify this.

            "Active content can harm your computer or disclose personal information. Are you sure that you want to allow CDs to run active content on you computer?"

            how can I prompt the user when the CD autorun?

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              This is a Windows/Microsoft/IE problem. One workaround is to use shellRun for your CD. See this link.

              Comment

              Working...