#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2010
    Posts
    14
    Rep Power
    0

    Talking 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:

    Code:
    <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:

    Code:
    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 :

    Code:
    <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. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4304
    I doubt there is a solution. I expect Chrome's popup-blocker is blocking it because window.open() is not being called directly from an event handler/listener that was triggered by a user.

    I suggest you use a LightBox type script, like Colorbox instead.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo