Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Window.open() not work in Google Chrome

    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){
    $.ajax({
    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");
    }
    });
    }
    </script>


    and it call in another JavaScript function like:

    function doKeyup(id,e)
    {

    if(e == 13) {
    //alert("e:"+e);
    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");
    getpage(firstId,'cp');
    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.

    Thankfully
    Anes

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    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?

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Also check if the ajax call is successful on Chrome. Put an alert in the success callback.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    New Coder
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question google Chrome Issue

    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
    reply.

    Regards
    Anes P.A

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    There is a big possibility that the popup is blocked by Chrome. Try this to confirm.

    Code:
    ...
    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.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •