Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

window.close function

Posted on 2004-10-01
7
Medium Priority
?
848 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:colonytire
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 2

Expert Comment

by:ewong_111
ID: 12203097
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..
0
 
LVL 10

Accepted Solution

by:
avidya earned 500 total points
ID: 12203271
Hi,

windows close only without userinterferance when they are opened with code.

A html on the desktop doesn't work, but a shortcut will
here is an example for IE, just replace yourpage.htm with your own:

"C:\Program Files\Internet Explorer\IEXPLORE.EXE" javascript:void(window.open('http://yourpage.htm',null,config='toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no'));
0
 
LVL 5

Author Comment

by:colonytire
ID: 12203470
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.

 
0
 
LVL 10

Expert Comment

by:avidya
ID: 12203882
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
0
 
LVL 5

Author Comment

by:colonytire
ID: 12204075
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.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question