My favorites | Sign in
Project Home Downloads Wiki Issues
New issue   Search
for
  Advanced search   Search tips
Issue 4158: Javascript won't open an alert box when run from within a popup window
6 people starred this issue and may be notified of changes. Back to list
 
Reported by d...@492ndbombgroup.com, Nov 6, 2008
Chrome Version       : 0.3.154.9
Other browsers tested:
     Safari 3: OK
    Firefox 3: OK
         IE 7: OK

What steps will reproduce the problem?
1. Link on web page must invoke Javascript to open a popup window 
containing HTML form and Javascript code for form validation. There is no 
problem in Google Chrome if the link is opened in a new window or tab using 
target="blank".
2. Form validation Javascript code in the popup window invokes 
alert(message) upon encountering an error within the form and sets focus to 
the appropriate form element.

What is the expected result?
Google Chrome should display the alert box.

What happens instead?
Google Chrome will execute all Javascript code EXCEPT for opening the alert 
box.


Comment 1 by *...@chromium.org, Nov 6, 2008
Could you please provide detail steps/example so that we can reproduce this issue? 

I tried javascript alert box in popup window, Chrome can display the alert box 
properly. 
Labels: -Area-Misc Area-Compat Need-more-info
Comment 2 by b...@trendsales.dk, Nov 7, 2008
same problem here.

Link opening content in pop-up window
<A HREF="javascript:NewWindow
('http://www.helloworld.dk/test.asp','name','500','525','no','yes')">

Using this javascript:

<SCRIPT TYPE="text/javascript">
var win = null;
function NewWindow(mypage,myname,w,h,scroll,status){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings 
= 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+sc
roll+',toolbar=0,location=0,menubar=0,status='+status+',dependent=0,titlebar=0,resiza
ble=0,locationbar=0'
win = window.open(mypage,myname,settings)
win.focus();
}
</script>

Confirm and alert javascript now suddenly doesn't work in the popup-vindue when user 
e.g. tries to submit a form that uses a confirm function:

<FORM ACTION=buy_wait.asp METHOD=POST id=form name=form onSubmit="return confirm
('are you sure you want to delete?');">

We hope that you can solve this one out quickly. We have a lot of customers now not 
being able to use our webservice while this issue persists.

Regards,
Bo
Comment 4 by jimpal...@gmail.com, Nov 8, 2008
Having the same issue with our product and confirm/alert dialogs not showing in popup
windows.

popup links:
<a onclick="window.open('popup.html', 'test', 'height=470,width=550'); return false;"
target="_blank" href="popup.html">anchor popup</a>
<div onclick="window.open('popup.html', 'test', 'height=470,width=550');">div popup</div>
<input type="button" onclick="window.open('popup.html', 'test',
'height=470,width=550');" value="button popup">

popup.html window code to try an alert() and a confirm():
<body>
	<input type="button" value="alert" onClick="alert('alert test');">
	<input type="button" value="confirm" onClick="confirm('confirm test');">
</body>

Have tried a slew of window.open features - basically the only way an alert or
confirm will work is if chrome renders the "popup" in a new tab by default which
happens when you include 'menubar=1,status=1,titlebar=1,toolbar=1,scrollbars=1'
chrome will automatically open the "popup" in a tab in the default configuration.
Comment 5 by krud...@gmail.com, Nov 10, 2008
Hi.

I have exactly the same problem.

THIS IS A SERIOUS BUG AFFECTING MANY WEB-APPS, PLEASE GIVE THIS TOP PRIORITY!

Have attached two files to illustrate the problem... see zipped attachment.
Just open the file: "start-chrome-popup.htm" first.

chrome-javascr-popup-bug3.zip
2.2 KB   Download
Comment 6 by *...@chromium.org, Nov 10, 2008
The problem is caused by javascript method "window.open(URL, windowName[, 
windowFeatures])". 
If the 3rd parameter windowFeatures is specified, then alert box doesn't work in the 
popup constrained window in Chrome, here is a simplified reduction:

http://go/reductions/4158/test-home-constrained.html

If the 3rd parameter windowFeatures is ignored, then alert box works in the popup in 
Chrome(the popup is actually opened as a new tab in Chrome), like this:

http://go/reductions/4158/test-home-newtab.html

it doesn't happen in IE7, Firefox3 or Safari3, it's a chrome specific issue.

See also attachments for simplified reductions
test-home-constrained.html
380 bytes   View   Download
test-home-newtab.html
354 bytes   View   Download
test-popup.html
107 bytes   View   Download
Status: Untriaged
Labels: -Need-more-info Has-reduction Chrome-specific JavaScript
Comment 7 by anan...@chromium.org, Nov 10, 2008
(No comment was entered for this change.)
Cc: o...@chromium.org m...@chromium.org
Comment 8 by mal.chromium@gmail.com, Nov 10, 2008
This looks like a recent regression.
Status: Assigned
Owner: e...@chromium.org
Labels: -Area-Compat Area-BrowserUI Mstone-1.0
Comment 9 by mal.chromium@gmail.com, Nov 10, 2008
This broke (intentionally) in r2116.

I'm going to revert 2116 from trunk and the release branch. We'll have to revisit the 
original bug with a different approach: this one does not work.
Comment 10 by erg@chromium.org, Nov 11, 2008
This should be fixed (with unit tests based on the reductions to prevent this form 
happening again) in r5198. mal directly committed the one line fix in web_contents.cc 
onto the release branch earlier.
Status: Fixed
Comment 11 by b...@trendsales.dk, Nov 13, 2008
When will this fix be released?

Thanks
Comment 12 by mal.chromium@gmail.com, Nov 15, 2008
This will be fixed in 154.22, which should go to the Dev channel next week. The fix 
should make it to the Beta channel before the end of November.
Comment 13 by inainsi...@gmail.com, Nov 17, 2008
Verified in the official build Chrome: V - 154.22
Status: Verified
Comment 14 by landreth...@gmail.com, Nov 17, 2008
I cannot get java to work on Pogo.  What steps do we need to do to fix this?  How do 
we access V-154.22 and is this problem fixed?
Comment 15 by bksen...@gmail.com, Nov 18, 2008
Chrome will only work with Java 6 Update 10.  You can download that from:
  http://java.sun.com/javase/downloads/

The 0.4.154.22 release is a dev channel only release.  If you're currently not 
subscribed to the dev channel, you might want to consider taking a look.  Information 
about subscribing to the dev channel is here: 
   http://dev.chromium.org/getting-involved/dev-channel

Comment 16 by krud...@gmail.com, Nov 18, 2008
Good job guys.... 
Tested the 0.4.154.22 (dev channel) and it worked as it should.

Look forward to see this in a public release though.....
Comment 17 by upendra....@gmail.com, Oct 26, 2009
Hi According to the above discussions, google chrome used 10 mths later should be 
showing alerts. I am trying today for a website - i have been using alerts to trace the flow of 
the code to take appropriate action, but the alert never happens, neither does the message 
get shown anywhere else.
26th Oct  09.
Any help please? I have some deliverables tomorrow .
 
contact.htm
9.9 KB   View   Download
Comment 18 by trustedf...@live.it, Feb 20, 2011
MMM... Chrome, for me the best browser, until I was blocked from some little silly bugs, like the one in this thread, now he has become one of my TEST browser and NOT my DEFAULT BROWSER :-((( ... Why, :-( !
Please correct your browser, my errors are the same of other guys, my relief it's that I aven't done nothing wrong with my code.
Please correct it :-)

My Specs: Windows 7, Chrome 9.0.597.98, webprogrammer Intel Core Duo,NvidiaVGA,4GBram.  
Comment 19 by cseg...@gmail.com, Oct 18, 2011
Hi,
I encounter the same problem with the confirm() dialog in Chrome 15.0.874.92 beta-m. 

     onclick="if (!confirm('Are you sure you want to delete this task?')) { return false; };"

I choose Cancel button and the form is submitted... Certainly I have tested this code in other browsers and worked fine in IE9, FF7, Opera11, etc.

Please fix it because I love Chrome and do not want to change it from default browser status.

Thank you and keep your otherwise excellent work.

Sign in to add a comment

Powered by Google Project Hosting