More control over Javascript Windows

I am launching a new window from the first page of a site within which everything will then be loaded.

My question is how can I get the opening window to either close or minimise after if has opened my new window.  What I want to be left with is just the window in the middle of the screen without the opener in the background.

My base platform is IE4.  I have searched everywhere for a solution but non has been forthcoming.  Also is it possible when opening the window to get rid of the really annoying controlbar at the top.  I have everything turned off that I know of but I still have the thick controlbar at the top.  If it can't turned off can it be made thinner?

At the moment I am just using a pretty standard opener script:-

var newWindow;
winOpts='menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,width=570,height=380';

      self.name = 'opener';
      Urlvar = "index2.htm";
      PCMBrowser = window.open(Urlvar,'newWindow',winOpts);

I'll start the points at 50 incase (as I suspect) the answer comes back as "Not Possible".  If it starts getting interesting I'll up the points.

Trevor.
LVL 5
Trevor013097Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Trevor013097Author Commented:
Edited text of question
0
jbrugmanCommented:
Try to use the self.close(); command. (with an onBlur option ore something like that)
onBlur="self.close();"
0
julio011597Commented:
You could use close(), as jbrugman sais, but even just after the open(), i guess.

window.open(Urlvar, ...);
window.close();

About the control bar: do you mean the "titlebar"?
If so, there's a "titlebar" Window's feature, but it has been implemented in NN4 (IE4), and to set it to "no", you need a signed script.

Regards, julio
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Trevor013097Author Commented:
Must be the heat (26 is hot for the UK!!) but I didn't even think of close();

however there is a problem with that method.  IE4 prompts you to confirm you wish to close the window with the message:-

-----
The web page you are viewing is trying to close the window.

Do you want to close the window?

Yes     No
-----

With regards the controlbar, yes I am referring to the title bar, what exactly is a signed script and how would I get one to do what I want.  Is it simply a Javascript which has been produced with a certificate which you tell your browser to accept as with Applets etc.

Trevor.

0
julio011597Commented:
To unconditionally close() a window you again need signed scripts.

Here are some additional infos from Netscape's JS Reference:

"The close method closes only windows opened by JavaScript using the open
method. If you attempt to close any other window, a confirm is generated, which lets
the user choose whether the window closes. This is a security feature to prevent "mail
bombs" containing self.close(). However, if the window has only one document
(the current one) in its session history, the close is allowed without any confirm. This
is a special case for one-off windows that need to open other windows and then
dispose of themselves."

About signing scripts, i've never done that, but have - again from Netscape site - downloaded a "JS Security Guide" (76Kb). Cannot remember the Url, but you should easily be able to find it in Netscape's developer corner, or give me your mail address so that i can send you the stuff.

-julio
0
Trevor013097Author Commented:
julio,

I don't need to worry about the close() security restriction having read your offering.  I am developing a front end for a CD-ROM which uses the autorun to launch index.html which then in turn uses window.open to give me a flotaing window without the usual IE baggage which looks more like the sort of menu system you get on coverdisks.

Seeing as the window I wish to close has no history it won't prompt for the confirm.  In my tests so far I had of course loaded something else and then opened the page manually and hence had a history.

If you would liek to post an answer I'll grade it 'A'.  If you think the points are a bit low then just say.

Trevor.


0
Trevor013097Author Commented:
julio,

Just tested the close() having loaded the first page directly, so that there was not a history and it still prompted me on closing.

Any thoughts?


0
btphelpsCommented:
If the browser is already open for any reason, you will get the prompt.

The first alternative, as somewhat described before, is to load a new window, e.g.,

<SCRIPT LANGUAGE="javascript">
<!-- Engage cloaking device

parentwinattr=window.open("filename.html", 'parentwinHome', "width=445,height=475,toolbar='NO',directories='NO',menubar='NO',status='NO',scrollbars='NO',copyhistory=1")
var helpWin=null;
self.close();

// Disengage cloaking device -->
</SCRIPT>

Alternatively, you can try adding a statement to your BODY tag:

ONLOAD="window.open('filename.html' target='_parent')"

which would put the filename back into the parent window without technically closing it. You can also write a function for the window.open statement above and substitute it in the BODY tag ONLOAD= parm.

Brian
0
julio011597Commented:
btphelps,

That still comes up with the same problem, I get a prompt to close the window even though I double-clicked on the file from explorer.

Why, if I am supposed to be able to close it without prompt if history is empty, am I still getting a prompt.  If I have a default page set in my options will this always be in my history even if I double-click a different file to open the browser?

Trevor.
0
Trevor013097Author Commented:
I've tried this on NN4.04, and it works as expected (even if i do have a home page set):

--//--
<HTML>
  <HEAD>
    <SCRIPT LANGUAGE="Javascript"><!--
      function doLoad() {
        self.open("next.htm");
        self.close();
      }
    // --></SCRIPT>
  </HEAD>
  <BODY onLoad="doLoad()">
  </BODY>
</HTML>
--//--

?? julio
0
julio011597Commented:
Have you tried closing the original window from within the new one?

if (windowName)  windowName.close();
0
cyberwizzCommented:
I did a lot of research, experimentation, and trial and error on this topic as I built a custom, cross-platform  HTML/JavaScript help system using pop-up windows earlier this year.

While  Netscape says that a brand new browser session opened with window.open, when closed using self.close() or its ilk,  will not display a prompt, for some reason no one at Microsoft read Netscape's documentation. IE4, in my experience, _always_ displays the prompt. No workaround I found got rid of it. I believe the ONLOAD..._top trick worked to avoid the prompt in Navigator 4.04, which has a bug having to do with self.close(), but it didn't work in IE4.

I don't think there is a solution to this question. Call this an answer if you want, though not the one you want to get.

Brian
0
btphelpsCommented:
IE can run in Kiosk mode, can't you have a shortcut on the cd with
iexplore -k file:\index.html

That would allow you to have a background of choice in index.htm and open a new page on top of that except a possible problem is MSIE not liking location.hrefs to be changed locally.

Now you have a full screen, no menues or bars perhaps it isn't needed anymore...

0
Michel PlungjanIT ExpertCommented:
mplungjan,

Absolutely brilliant.  Where on earth did you find the kiosk mode documented.  It is even better than what I asked for.  Submit an answer and the points are yours.

Sorry I couldn't give points to everyone but in all fairness mplungjan has come up with a suitable solution for IE which I did specify in my original question whereas all others were for NN4.

Trevor.

0
Trevor013097Author Commented:
IE can run in Kiosk mode, can't you have a shortcut on the cd with
iexplore -k file:\index.html

Glad to be of service, did take some testing first...

Michel
0
Michel PlungjanIT ExpertCommented:
Hi All,

I think I have just accidentally stumbled across an extremely neat way to close window that was NOT opened with Javascript without causing any alerts.  Could someone confirm it.  I checked all my option settings and I think I have most relevant warnings on.

Basically I used an IFRAME (this will therefore only work in IE) and in that I frame the document it loaded closed itself.  Didin't get any alerts.  This is the code I had:

Main Page:

<html>

<head>
<title>Parent Document</title>
</head>

<body>
<Iframe id="Child_Document" src="popup.html" onLoad="alert('Finished');"> </iframe>
</body>

</html>


Child Page (called popup.html):

<HTML>
<HEAD>
<TITLE>Open Pop-up that auto closes after 5 seconds</TITLE>
<SCRIPT LANGUAGE="Javascript">
<!--

function closeNow() {
   self.close();
}

//-->
</SCRIPT>
</HEAD>

<BODY onLoad="setTimeout('closeNow()', 5000);">

This will close after 5 seconds

</BODY>
</HTML>

Trevor.


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Trevor013097Author Commented:
The onLoad within the IFRAME was something else I was testing and is not relevant to the self closing.

Trevor.


0
Trevor013097Author Commented:
It does not do anything in MSIE 3.02 - not even after loading the page containing the iframe as a new window....

Good idea, though

Michel
0
Michel PlungjanIT ExpertCommented:
Maybe it will only work in IE4, thats what I tested it one.

Trevor.

0
Trevor013097Author Commented:
Sorry, I do not currentlyhave access to ie4

Michel
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.