473,546 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

prompt being blocked by popup blockers

3 New Member
I am having a problem with the prompt message being blocked by popup blockers. (I think)

I have the following javascript code on my page and some customers are having a problem with the prompt message. They get the confirm message and answer yes and then it immedietly puts up the message "Approval Process cancelled". Other customers are fine.

I figure this is due to popup blockers on thier box. This is what I have tried and nothing seems to fix it on this box.

1. Enable popups on the page.
2. Clear temp files and cookies
3. Hold Ctrl key when doing the approval
4. Allow the web site under the pop-up blocker in the internet tools. (In the privacy setting tab)

Nothing seems to work. They can go to another machine and it allows them to approve but I need to find out what is stopping it on this machine.


The asp page calls a javascript function that contains the following codewhen a button is clicked.


Expand|Select|Wrap|Line Numbers
  1. if (confirm("Are you sure you wish to APPROVE this property?") == false)
  2. {
  3.     return;
  4. }        
  5.  
  6. var answer = prompt("Please enter your First Name, Last Name and Title.","");
  7.  
  8. if (answer == null) 
  9. {
  10.  // cancel
  11.  alert("Approval Process cancelled");
  12.  return;
  13. }
  14.  
I would appreciate any help
Jan 4 '07 #1
2 2539
acoder
16,027 Recognized Expert Moderator MVP
The problem is IE7 has disabled prompt by default. Either change the settings on each browser or use an alternative - here's one.
Jun 3 '08 #2
mrhoo
428 Contributor
There are easier ways, including a hidden input field on your page.

Nothing completely mimics a window.prompt, but you can come close with
something like this- customise the style to suit.
Expand|Select|Wrap|Line Numbers
  1. // Start with an object to hold a couple methods
  2.  
  3. if(typeof Run!= 'object')Run={};
  4.  
  5. // event handler method
  6. Run.addEve= function(who,what,fun){
  7.     if(who.addEventListener) who.addEventListener(what,fun,false);
  8.     else if(who.attachEvent) who.attachEvent('on'+what,fun);
  9. }
  10.  
  11. // faux prompt:
  12. Run.prompter= function(str1,str2,callback){
  13. // first insert a layer to overlay the page- 
  14. // the prompt isn't truly modal, but mouse events are blocked
  15. // until you deal with the prompt.
  16.  
  17.     var isIE= !document.addEventListener && document.attachEvent;
  18.     var sy= document.documentElement.scrollTop || 
  19.     document.body.scrollTop;
  20.     var py= screen.height+sy;
  21.  
  22.     var P1= document.createElement('div');
  23.     var sty= {position:'absolute',top:'0px',left:'0px',
  24.     width:'100%',height:py+'px',
  25.     zIndex:'1000000000',backgroundColor:'white'};
  26.  
  27.     if(isIE) sty.filter= 'alpha(opacity=10)' ;
  28.     else sty.opacity= '.2';
  29.  
  30.     for(var p in sty) P1.style[p]= sty[p];
  31.     P1.id= 'modalDiv';
  32.     document.body.appendChild(P1);
  33.  
  34.     // create the prompt div
  35.     var elDiv= document.createElement('div');
  36.     elDiv.id= 'promptDiv';
  37.     sty= {position:'absolute', top:(100+sy)+'px',left:'25%',width:'30em',
  38.     border:'2px ridge black',backgroundColor:'#ddd',color:'black',
  39.     zIndex:'1000000001',paddingBottom:'1em'};
  40.  
  41.     for(var p in sty) elDiv.style[p]= sty[p];
  42.     var el= document.createElement('h3');
  43.     el.appendChild(document.createTextNode(str1));
  44.     elDiv.appendChild(el);
  45.  
  46.     // input and buttons
  47.     el= document.createElement('p');
  48.     elDiv.appendChild(el);
  49.     var elT= document.createElement('input');
  50.     elT.type= 'text';
  51.     elT.size= '24';
  52.     elT.value= str2 || '';
  53.     el.appendChild(elT);
  54.     var elB= document.createElement('button');
  55.     elB.appendChild(document.createTextNode('OK'));
  56.     el.appendChild(elB);
  57.     var elB2= elB.cloneNode(false);
  58.     elB2.appendChild(document.createTextNode('Cancel'));
  59.     el.appendChild(elB2);
  60.  
  61.     // remove it (after callback)
  62.     var zap= function(){
  63.         setTimeout(function(){
  64.             document.body.removeChild(
  65.             document.getElementById('promptDiv'));
  66.             document.body.removeChild(
  67.             document.getElementById('modalDiv'));
  68.         },
  69.         250);
  70.     }
  71.     // assign handlers- enter key will work as well as mouse click
  72.     if(typeof callback== 'function'){
  73.         Run.addEve(elB,'click',function(){ callback(elT.value) });
  74.     }
  75.     Run.addEve(elB,'click',zap);
  76.     Run.addEve(elB2,'click',zap);
  77.     document.body.appendChild(elDiv);
  78.     elT.focus();
  79. }
// test case- arguments: prompt text, default input, callback function

Run.prompter('T ype a value','',funct ion(tem){alert( tem)});
Jun 3 '08 #3

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

Similar topics

38
5010
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find out what i'm doing wrong, and so far it seems i'm doing it the right way. Here's my code...any suggestions would be appreciated. <script...
3
1935
by: Dan | last post by:
First, I'm sorry if this question has been asked too many times. I'm new to this news group. The question has to do with the use of popup windows in a web page. I have heard that popup windows should be avoided; due to use of popup blockers and browser that do not process javascript. Is the use of popup windows bad design? Will it...
8
1950
by: Bijoy Naick | last post by:
It seems like the BBC sports site is able to get past popup blockers.. For eg.. http://news.bbc.co.uk/sport1/hi/cricket/default.stm. Click on the Video icon under "Watch and Listen" - right hand frame. I have a popup blocker installed but the window still pops up.. Any one know how this can be done? BTW: I need this functionality for an...
2
1851
by: Robert Oschler | last post by:
We like to pop-up context help windows when a user clicks on certain terms on our web pages. However, the popup blockers seem to block any links with "target=_new" or "target=_blank". Is there a way with Javascript to open a new window that is acceptable to the popup blockers? These context help windows are a direct result of a user click,...
15
18707
by: | last post by:
So many websites can get around my Googlebar's popup blockers. Even Opera 8 can not stop those popups. I looked into the codes, and I can find nothing showing me how it is done. Can anyone help me find what how it is done? First go to http://www.sitepoint.com/forums/showthread.php?t=184025&page=1&pp=25 Click on Last ? on the page
17
3833
by: Chris Ianson | last post by:
Hi, I have this JavaScript, which I only want to occur if a user clicks on a hyperlink hotspot in a large image: <script type="text/javascript"> <!-- var answer = confirm ("This link is not available, click OK to load a similar link, or Cancel to not.") if (!answer) window.location="http://www.yahoo.com/" // -->
4
4260
by: vickeybird | last post by:
I want to know if it is possible to detect if Pop up Blocker is enabled without trying to open a Pop Up windows. I'm trying to create a web analytics script and visible Pop up in case of disabled PopUp Blocker is not being accepted.
4
3265
by: dd | last post by:
I have a scenario where my popups are being blocked by IE6+ and Firefox. The problem is that although the popup is a direct result of the user clicking on the link (meaning that they WANT the popup), when it comes to opening it, I'm doing it via a JavaScript function and by the time the popup is opened the browser doesn't know it was as a...
2
2306
by: Greg Taylor | last post by:
Greetings, I was wondering if there was a way to make prompt() calls in Safari show a single-line input box instead of the default multi-line prompt that it currently does. It seems like most other browsers just provide a single-line prompt text box, meaning that the user hitting ENTER is the same as them hitting the "Ok" button. In...
0
7504
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6026
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.