www.webdeveloper.com
Results 1 to 8 of 8

Thread: IE vs FF window.open() - getting error

  1. #1
    Join Date
    Sep 2008
    Posts
    104

    IE vs FF window.open() - getting error

    I'm getting an odd error with window.open() in IE. Works fine in FF. From everything I've read, the 2nd parameter that becomes the window title just can't contain spaces, which it doesn't. Can I not set it programmatically?

    Code:
    querystring="client="+client+"&label="+label;
    target="myPage.php?"+querystring;
    client=jQuery.trim(client);
    //alert(client);
    window.open(target,client,'width=400,height=200,resizable=yes,scrollbars=yes');

  2. #2
    Join Date
    Apr 2010
    Location
    Salem,Ma
    Posts
    623
    how is "client" being defined before your trim it?

  3. #3
    Join Date
    Sep 2008
    Posts
    104
    Sorry, should have included that. It's getting passed into the function in an onClick event.

    Code:
    function myPageCall(client){
    //example of client:
    //group-server123-app_name-1.0.0-a
    //example of label:
    //654321
    
    var label = "";
    var selectedVersion = document.getElementById("versions").value;
    selectedVersion = selectedVersion.split("@");
    label = selectedVersion[2];
    
    querystring="client="+client+"&label="+label;
    target="myPage.php?"+querystring;
    client=jQuery.trim(client);
    //alert(client);
    window.open(target,client,'width=400,height=200,resizable=yes,scrollbars=yes'); 
    }
    Last edited by mcru; 05-10-2011 at 10:24 AM.

  4. #4
    Join Date
    Apr 2010
    Location
    Salem,Ma
    Posts
    623
    hehe. almost there. Now please show the exact markup your using so we can see what your passing as "client"

  5. #5
    Join Date
    Sep 2008
    Posts
    104
    It's being dynamically generated from php. Here's an exact value for $client that I echo'd out right before the link below is generated. I put the single quotes in to see where any white space might be.

    Code:
    echo "'".$client."'";
    ^ outputs: 'qa-qcactten05v-duar_cons-1.0.0-a'

    Code:
    echo "<br /><br /><input type=button value=\"Install Selected Version\" onClick=\"myPageCall('".$client."')\"></input>";

  6. #6
    Join Date
    Sep 2008
    Posts
    104
    and here is the actual markup being generated (there's no way this could be the lack of quotes around the type property, right?):

    Code:
    <input type=button value="Install Selected Version" onClick="myPageCall('qa-qcactten05v-duar_cons-1.0.0-a')"></input>
    I also updated my function at top to how i'm actually getting the label var in my page. I had just threw it in the function for simplicity earlier.
    Last edited by mcru; 05-10-2011 at 10:25 AM.

  7. #7
    Join Date
    Apr 2010
    Location
    Salem,Ma
    Posts
    623
    hmm. well looks like everything is ok with the client variable and it appears your passing it correctly to the function. I'm going to take a shot in the dark, and say maybe it's "target" that has the issue. FF and IE seem to handle urls a bit differently, meaning
    Code:
    target="myPage.php?"+querystring;
    may be fine for some browsers but others may want it as
    ( forgive my lack of technical terms, I'm not a pro(yet))

    Code:
    target="/myPage.php?"+querystring;
    - also what's the error? perhaps that will shed some light until someone more experienced takes a look at this for you

    ( also ignore my previously deleted post, your doing it right. I just make a point never to use window.open so I'm not intimately familiar with it's use)

  8. #8
    Join Date
    Sep 2008
    Posts
    104
    So it was either the "-" or the "."'s in the client string. Removing them from the string worked for me.

    Code:
    clientName=jQuery.trim(client);
    clientName=clientName.replace(/-/g,"");
    clientName=clientName.replace(/_/g,"");
    clientName=clientName.replace(/\./g,"");
    window.open(target,clientName,'width=400,height=200,resizable=yes,scrollbars=yes');
    Thanks for the input!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles