Connecting Tech Pros Worldwide Forums | Help | Site Map

popup blocker blocks javascript

Newbie
 
Join Date: Feb 2007
Posts: 8
#1: Feb 14 '07
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="JavaScript">
<!--

function detectPopupBlocker() {
var myTest = window.open("about:blank","","directories=no,heigh t=100,width=100,menubar=no,res izable=no,scrollbars=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 = detectPopupBlocker;
//-->
</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

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Feb 14 '07

re: popup blocker blocks javascript


Use the other way round, i.e. test for myTest, e.g. try the following:
Expand|Select|Wrap|Line Numbers
  1. function detectPopupBlocker() {
  2. 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");
  3. if (myTest) {
  4. myTest.close();
  5. alert("No popup blocker was detected.");
  6. } else {
  7. alert("A popup blocker was detected.Please allow this program to continue.");
  8. }
  9. }
  10. window.onload = detectPopupBlocker;
This works in Firefox.
Newbie
 
Join Date: Feb 2007
Posts: 8
#3: Feb 14 '07

re: popup blocker blocks javascript


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?!!!
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Feb 14 '07

re: popup blocker blocks javascript


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.
Newbie
 
Join Date: Feb 2007
Posts: 8
#5: Feb 15 '07

re: popup blocker blocks javascript


Quote:

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 ?
Newbie
 
Join Date: Feb 2007
Posts: 8
#6: Feb 15 '07

re: popup blocker blocks javascript


Quote:

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?
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#7: Feb 16 '07

re: popup blocker blocks javascript


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


Similar JavaScript / Ajax / DHTML bytes