Link to home
Start Free TrialLog in
Avatar of colonytire
colonytireFlag for United States of America

asked on

window.close function

I have read many posts and still find no resolution to my problem as it relates to the window.close() and getting the popup window where the user must allow the window to close.  I also tried using the self.close() and had the same results. I have included the code below.

The ultimate goal is to create a "Launcher" page that will open a URL in a maximized window, and have NO title (not sure this is possible), toolbars, status bar or menu bars. After it launches the URL I need the parent / launcher window to close automatically.  This is going to be used in a Kiosk type environment yet I do not want the full screen affect that kiosk mode creates.  The code below works perfectly with the exception that it prompts the aggrivating "Do you wnat to close this window?" box and that the new window has the Title displayed along with Microsoft Internet Explorer across the top.  I realize this is due to a security problem and generic branding, but it will be used internally.

************  Code copy  ***************

 <html>

      <head>
            <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
            <title>Launcher</title>
            <csactionitem name="launch"></csactionitem>
                  <csactions>
                  <csaction name="launch" class="Open Window" type="onload" val0="http://blahblahblah" val1="_blank" val2="0" val3="0" val4="true" val5="true" val6="false" val7="false" val8="false" val9="false" val10="false">
            </csactions>
            <csscriptdict>
                  <script><!--
CSInit = new Array;
function CSScriptInit() {
if(typeof(skipPage) != "undefined") { if(skipPage) return; }
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
      idxArray[i] = i;
CSAction2(CSInit, idxArray);}
CSStopExecution = false;
function CSAction(array) {
      return CSAction2(CSAct, array);
}
function CSAction2(fct, array) {
      var result;
      for (var i=0;i<array.length;i++) {
            if(CSStopExecution) return false;
            var actArray = fct[array[i]];
            if(actArray == null) return false;
            var tempArray = new Array;
            for(var j=1;j<actArray.length;j++) {
                  if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
                        if(actArray[j][0] == "VAR") {
                              tempArray[j] = CSStateArray[actArray[j][1]];
                        }
                        else {
                              if(actArray[j][0] == "ACT") {
                                    tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
                              }
                        else
                              tempArray[j] = actArray[j];
                        }
                  }
                  else
                        tempArray[j] = actArray[j];
            }                  
            result = actArray[0](tempArray);
      }
      return result;
}
CSAct = new Object;

function CSOpenWindow(action) {
      var wf = "";      
      wf = wf + "width=" + action[3];
      wf = wf + ",height=" + action[4];
      wf = wf + ",resizable=" + (action[5] ? "yes" : "no");
      wf = wf + ",scrollbars=" + (action[6] ? "yes" : "no");
      wf = wf + ",menubar=" + (action[7] ? "yes" : "no");
      wf = wf + ",toolbar=" + (action[8] ? "yes" : "no");
      wf = wf + ",directories=" + (action[9] ? "yes" : "no");
      wf = wf + ",location=" + (action[10] ? "yes" : "no");
      wf = wf + ",status=" + (action[11] ? "yes" : "no");            
      window.open(action[1],action[2],wf);
}

// --></script>
            </csscriptdict>
            <csactiondict>
                  <script><!--
CSInit[CSInit.length] = new Array(CSOpenWindow,/*URL*/ 'http://blahblahblah','_blank',0,0,true,true,false,false,false,false,false);

// --></script>

            </csactiondict>
      </head>

      <body bgcolor="#ffffff" onload="CSScriptInit(); window.close(); return false">
            <p></p>

      </body>


</html>

************** End copy  ***********************

As you see I tried using "return false" but still get prompted.  I also tried self.close() and get the same results.

Details:

This will be a Short cut / html file on the desktop of a Windows XP Pro w/ srv pk1 PC, and the URL will be for a local network server.

How do I avoid the window and remove the text in the title area?

Could I do this easier through some sort of batch script or arguments in the short cut link?


TIA
Avatar of ewong_111
ewong_111

You can try to launch a blank window, and use the blank window to launch the "launcher" window:

<script language="javascript">
newwin = window.open('launcher.html');
function getgoing(url){
      newwin.close();
      window.location.href = url;
}
</script>

and use the launcher window to set up values in the first window and then ask the first window to close the launcher window..

<script language="javascript">
      window.opener.getgoing('http://www.yahoo.com');
</script>

Hope this helps..
ASKER CERTIFIED SOLUTION
Avatar of avidya
avidya

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of colonytire

ASKER

OK, that got me close but it doesn't close the initial window. I am left with 2 windows.  The active / in front window is good., however I have a second window in the task bar and it's title is javascript:void....bla blah.  How do I get the initial window created from that shortcut to close?  I tired adding the window.close() to the end of your command sting but that takes me back to the popup window.

 
oeps, sorry, just tought I made an error posting.
didn't know it was an security issue.

Cobal, please delete this comments and sorry again
Sorry to have caused such a rucuss.  The end result is that it worked fine. I see the position of the admins for not wanting such posts.  This is being used internally and as the admin take full responsibility of it's use. Our end users may be holding the mouse but I control the content.

I will be awarding the points to Avidya. COBOL you may delete the entire question if need be.

Thank you all for helping.