By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,747 Members | 1,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,747 IT Pros & Developers. It's quick & easy.

popup blocker blocks javascript

P: 8
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
Feb 14 '07 #1
Share this Question
Share on Google+
6 Replies

acoder
Expert Mod 15k+
P: 16,027
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.
Feb 14 '07 #2

P: 8
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?!!!
Feb 14 '07 #3

acoder
Expert Mod 15k+
P: 16,027
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.
Feb 14 '07 #4

P: 8
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 ?
Feb 15 '07 #5

P: 8
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?
Feb 15 '07 #6

acoder
Expert Mod 15k+
P: 16,027
This is a Windows/Microsoft/IE problem. One workaround is to use shellRun for your CD. See this link.
Feb 16 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.