Search code examples
javascriptwindow.open

window.open() opening a tab instead of a window in Chrome using user input as url source


Not matter what I try, this code is still opening in a new tab. Any ideas on how to modify this to make a new window open?

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Cast Challonge</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
    
    <script type="text/javascript">
    
    $(document).ready(function(){
    
        $('#button').click(function(e) {  
            var inputvalue = $("#input").val();
            window.open("http://challonge.com/"+inputvalue+"/module?theme=5928&show_final_results=0&multiplier=0.3&show_tournament_name=1&scale_to_fit=1"),"_blank","width=1323,height=816";
    
        });
    });
    </script> 
    </head>
     <body>
    
           <input type="text" value="" id="input"> 
           <button type="button" id="button">Submit Tournament ID</button>
    </body>
    </html>

Solution

  • Sharing the correct answer in case anyone ever needs this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" >
            <head>
                <title>Cast Challonge</title>
            <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
            
            <script type="text/javascript">
            
            $(document).ready(function(){
            
                $('#button').click(function(e) {  
                    var inputvalue = $("#input").val();
                    window.open(("http://challonge.com/"+inputvalue+"/module?theme=5928&show_final_results=0&multiplier=0.3&show_tournament_name=1&scale_to_fit=1"),"_blank","width=1323,height=816";)
            
                 });
            });
            </script> 
             </head>
             <body>
            
                   <input type="text" value="" id="input"> 
                   <button type="button" id="button">Submit Tournament ID</button>
             </body>
            </html>