View Full Version : Window.open() not work in Google Chrome

11-16-2010, 01:07 PM
Hi Friends,
I am really tired with Chrome , one of my window.open() Stuff work fine in FF and Opera in
Fedora O.S. But Chrome Did not , my code is like:

<script type="text/javascript">
function getpage(id, type){
type: "POST",
data: "key="+id,
async: false,
url: "<?php echo site_url(); ?>/server/precp/"+type,
success: function (msg) {
window.open("<?php echo site_url(); ?>/server/cplogin/"+msg, "autologin");

and it call in another JavaScript function like:

function doKeyup(id,e)

if(e == 13) {
var cp = $("table#serverdata tbody tr#container_tr.row_no td:nth-child(7) a#cp").html();
var dc = $("table#serverdata tbody tr#container_tr.row_no td:nth-child(7) a#dc").html();
if(cp != null || dc != null ) {
var firstId = $("table#serverdata tbody tr#container_tr.row_no td:nth-child(1) input[type=checkbox]").val();
if(cp != null) {
alert("Enter here");
return false;

and it firstly call from onkeyup as :

<input type="text" name="find_text0" id="find_text0" autocomplete="off" <?php if ('B' == $sb_pos) { ?> onfocus="document.getElementById('find_text1').value='';" <?php } ?> onkeyup = "return doKeyup('0',event.keyCode);" />

Please Give me a Solution ASAP.

Anes :)

Logic Ali
11-16-2010, 06:03 PM
It looks as though you're trying to open a window from a keyboard event. If so it's quite reasonable for it to be blocked. Are there any related messages in Chrome's error console?

11-16-2010, 07:55 PM
Also check if the ajax call is successful on Chrome. Put an alert in the success callback.

11-19-2010, 05:21 AM
Hi Friends,

There is No Error message in Chrome Console and the ajax call is successful. But
actually the problem is not open the new Window. I check the Functions with
alert the values all are working Well. Any other possibility of solution , waiting your

Anes P.A :(

11-19-2010, 06:03 AM
There is a big possibility that the popup is blocked by Chrome. Try this to confirm.

success: function (msg) {
alert('ajax call successful! opening popup...');
var win = window.open("<?php echo site_url(); ?>/server/cplogin/"+msg, "autologin");
alert('win=' + win);
If Chrome alerts win=null, then the popup was blocked.