Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript to Programmatically disable IE Toolbar and MenuBar 2

Status
Not open for further replies.

30101

Technical User
May 22, 2002
18
GB
Hi,
Does any one knows how to use a javascript to Programmatically disable internet explorer browser toolbar and menubar. I need this when the first page loads.
A simple step by step will be appreciated.

Newbie......

Eddie

 
Eddie,

Microsoft and Netscape prevent you from changing those items in the users "Original" window by way of script. However, if you launch a new window through script, you may then have that control over the new window. But not the original window.

ToddWW
 
Thank you ToddWW for your reply, How do I launch a new page through a script?
Any ideas.

Eddie
 
Eddie,

One possibility is to immediately open a brand new window in your application and work everything from that window. The new window would, of course, have none o' that fancy stuff.

If you're feeling frisky, you could even automatically close the parent window, but you have to put up with a prompt.

Here are three files.

Save this as "Sample.html":

Code:
<!DOCTYPE html 
     PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
     &quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>[/URL]

<html xmlns=&quot;[URL unfurl="true"]http://www.w3.org/1999/xhtml&quot;[/URL] xml:lang=&quot;en&quot; lang=&quot;en&quot;>
  <head>
    <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;></meta>
    <title>JavaScript Sample</title>
    <script src=&quot;Sample.js&quot; type=&quot;text/javascript&quot;></script>
  </head>
  <body>
    <input type=&quot;button&quot; value=&quot;popit!&quot; onclick=&quot;InitWinders();self.close();&quot;></input>
  </body>
</html>

Save this as &quot;Sample.js&quot;:

Code:
function InitWinders()
  {
    // Declare variables
       var NewWindow
    // Open a blank Document window
       NewWindow = window.open('SampleWindowContents.html','Sample','top=0,screenY=0,left=0,width=300,height=150,scrollbars=no,scrollbar=no,menubar=no');
  }

And save this as &quot;SampleWindowContents.html&quot;:

Code:
<!DOCTYPE html 
     PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
     &quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>[/URL]

<html xmlns=&quot;[URL unfurl="true"]http://www.w3.org/1999/xhtml&quot;[/URL] xml:lang=&quot;en&quot; lang=&quot;en&quot;>
  <head>
    <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;></meta>
    <title>JavaScript Sample Window</title>
  </head>
  <body>
    <p>This is the brand new window, complete with focus.</p>
    <p>Seems to work best on IE.</p>
  </body>
</html>

Hope that helps.

Cheers,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Hi Edward,
Thank you for your suggestion.
Well appreciated.

eddie.
 
eddie,

If you replace the

Code:
<body>

in &quot;SampleWindowContents.html&quot; with

Code:
<body onload=&quot;opener.opener = self; opener.close();&quot;>

then it will close the parent window.

In other words, by shifting the soul of your app to the new window and trashing the old corpse, you can essentially do what you're asking.

Of course, for suggesting such a discourteous practice, I'm going straight to hell.

Cheers,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Edward,

I haven't used that syntax on closing the opener window before. Does that prevent IE from prompting you to confirm that you want to close the window ?

Thanks. Great ideas !

ToddWW
 
Not even a kiss goodbye, and the parent window softly and suddenly vanishes away.

For one of my li'l Satanic apps, I'm trying to make it such that immediately upon hitting the page, the page is replaced by a duplicate window of the same size, shape, and location, with the parent window being closed. Blip! All gone, all under the covers. Practically, this means the browser window suddenly becomes more &quot;app-like&quot; or &quot;Satanic&quot;. This evidently makes me &quot;employable&quot;.

What a world...

Cheers,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Just emailed it to myself. Thanks for your tips.

ToddWW
 
Hi Edward,

Bravo You are a star, thank you for the excellent and imaginative tip...........


eddie.
 
I stand on the shoulders of giants...

But thanks anyways!

Cheers,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top