Welcome, Guest
  • Author Topic: JS new window stuff works in FF, sorta works in IE, but crucial part don't  (Read 2174 times)

    shawn gibson

    • Seasoned Programmer
    • ***
    • Posts: 103
      • MSN Messenger - sgibson777@hotmail.com
      • Yahoo Instant Messenger - shawn.gibson@yahoo.com
      • View Profile
      • faceitphoto.ca
      • Email
    Forgive my ignorance, trying to use the SWFObject etc...works ok in the same window in IE, and I can open a new window (popup) in FF as well. However, my code (borrowed, I'm no JS guru) is giving me errors that don't even make sense to me...won't load a new window in IE at all, and gives me various errors. FF is fine for all of it!

    It should be  simple fix, I'm just stupid with this, if I may please  post some code.

    First, this works fine in IE + FF:

    <!--
    var screenHeight = screen.height;
    var screenWidth = screen.width;
    document.write('<p class="style1" style="color:white;">Your screen is set to ' + screenWidth + 'x' + screenHeight + ' resolution.');
    // -->


    Next, , this doesn't work in IE, but does in FF:

    <a href="#" onclick="newWindow('main.html','screenWidth','screenHeight','resizable=no,scrollbars=no,status=no,toolbar=no')">HERE</a>

    I bolded what seems to be the problem.

    Finally, in the first place, this code is placed in the head:

    <!-- Begin
    var win = null;
    function newWindow(mypage,myname,w,h,features) {
      var winl = (screen.width-w)/2;
      var wint = (screen.height-h)/2;
      if (winl < 0) winl = 0;
      if (wint < 0) wint = 0;
      var settings = 'height=' + h + ',';
      settings += 'width=' + w + ',';
      settings += 'top=' + wint + ',';
      settings += 'left=' + winl + ',';
      settings += features;
      win = window.open(mypage,myname,settings);
      win.window.focus();
    }
    //  End -->

    ...To see what I mean, I'm trying to open a blank window based on the user's resolution, if they choose, as you can see by a look at the page
    (link to follow).

    I use the SWFObject for embedding.

    Any suggestions? Here is a peek if you need a visual reference: http://shawngibson.com (click shawngibson.com from there...this is just my testing server for now).

    Any help would be appreciated.

    Shawn

    If I can build this site, it will be like staring God in the eyes, as it's a challenge each step of the way far beyond me, but I am far beyond driven.

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Probably the string you get as features doewsn't like IE (some extra comma or the like) trace it to see how it loooks:

    alert(settings)

    Jorge