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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change window attributes under IE

Status
Not open for further replies.

Floof

Technical User
Apr 25, 2001
23
FR
Hello, I am looking for a solution on how to change window attributes with JScript under IE ... [soapbox]

[machinegun]-->IE<--

I know I can use the Window Features parameter of the &quot;open&quot;
method, but I would like to change those while the window is already open. (like changing innerWidth or innerHeight or locationbar etc ...)

Anyone has an idea ? [sadeyes]

Thanks ;-)
Floof
 
&quot;Anyone has an idea?&quot;--No, because as far as I'm aware, it's not possible.

Rick -----------------------------------------------------------
 
Well ...
It is possible under Netscape ...

Code:
window.menubar.visible = true|false;
window.innerHeight = innerHeight;

So there must be a way ...

Maybe someone knows a trick to do this ...
 
But Netscape is a completely different browser. eg. It's possible to &quot;zoom&quot; in IE 6, but not in Netscape. They just have different features, that's it.

Rick -----------------------------------------------------------
 
In Internet Explorer, this is possible (in later versions) with the
Code:
window.showModalDialog()
method. Use:
Code:
window.showModalDialog(<URL>,<arguments>,scroll:no
You can also use the
Code:
resizable:no
feature to make your window non-resizable, and there are numerous other features of this function that affect size, screen position, and other aspects of the dialog window's appearance. If you want a good hard-copy JavaScript reference manual (which I find indispensable for checking on browser/version command accessibility and attribute lists/syntax), I recommend &quot;Inside JavaScript&quot; by Steven Holzner (New Riders, 2002). It's big and kinda pricey ($50U.S./$80Cdn), but definitely worth it. I'm losing my hair naturally, so not having to tear quite so much of it out on a daily basis is *very* nice.
 
Addendum: No, there isn't really a way to do this with &quot;normal&quot; windows in IE without something to do with security privileges; you need to make the page a stand-alone HTML app in order to remove the menubar, statusbar, titlebar, etc. in IE, but it is possible somehow. Check Microsoft's website for the details (sorry, I don't have the URL handy, but search Microsoft.com for &quot;JScript window&quot; and you should find it quickly; I know it didn't take me too long to track it down when I went looking for it).
 
If you created this &quot;window&quot; in your script, simply reference the object and modify the attributes. For example the two functions below, open a window and then resize the window.

<script language=javascript>
var hndl=null; //global

function OpenChild(){
var myBars='directories=no,location=no,menubar=no,status=no,titlebar= no,toolbar=no,alwaysRaised=no,z-lock=no';

var MyOptions='width=100,height=100,resizable=yes,visable=yes'
var myFeatures = myBars + ',' + myOptions;

hndl = open(&quot;test_child.htm&quot;,&quot;Child&quot;,myFeatures);
return true;
}

function ResizeChild(){
hndl.resizeTo(200,200);
hndl.focus();
return true;
}
</script>

If there is just one window, then just reference the &quot;window&quot; object and set the values.

Is this what you're looking for or am I totally off base?

Russell
 
The thing, is that I don't want to use a window.open call,
my window is already opened, I just want to change bars
visibility, and window's innerHeight and innerWidth, but I
don't have access to these features once the window is
opened.

The window.resizeTo(200,200) changes only the outerWidth
and outerHeight parameters.

Thanks for your help anyway, :)

Floof.


Javastripped : How do you create a stand-alone HTML app ?
 
Okay... not really familiar with TGML, so couldn't paste this in as a link, but here's the URL for some of Microsoft's docs on the process (IE5/5.5):
Note that the article seems to indicate that you need InterDev to make this work, and I have no idea what the package goes for these days; I'm not (yet) a professional coder. If you have the MCSD cert, it's probably a lot cheaper. You can probably find more info on this process in IE6 if you search the support archives (I don't have time to do this right now, sorry).
 
Anyway, something else I just thought of... innerHeight and innerWidth can be modified on-the-fly in Netscape 4 and 6, but not in IE at all. I'm getting this from a book I recommended to another poster: Inside JavaScript, by Steven Holzner (New Riders, 2002/3). I guess how you handle this all depends on what or who the site is for. If it's for an intranet that only uses recent versions of Netscape, then you're set. Otherwise, I can't think of anything else that would do the trick elegantly.
As far as InterDev and HTML apps go, also check this link:
 
And then, re-reading the original post, I see that IE was specified. Oops. my bad.
[noevil]
Anyway, I'll continue to investigate the problem. I code solely for IE (and solely for my own use, at the moment, but I will be getting a site live as soon as I have the reassurance of a regular paycheck).
If I come up with anything, I'll post it. Good luck!
 
Not to mention the fact that I already plugged that book in this thread...
Maybe I just need to get away from the screen for a while...
Yeah... that's it... take a break... let my brain idle for a while before it burns out... OK... I'm outta here. Maybe I'll be a little more coherent once I get my hands on a decent code editor and don't have to use Notepad any more. Thousand-line scripts and Notepad do not a coherent coder make.
 
ok, thx javastripped,[bigcheeks]

I still have my problem :

- I don't want to use window.open(), because i have to do it in another window, that I later have to close, so I have the conf. dialog that appears ... and I don't want this.

- I can't change the window attributes from within the window, so I think I'll never manage to get this working.

I think I'll have to put a homepage with just a link with URL :
&quot;javascript:window.open('URL','win_name','win_feats')&quot;

Thanks for your helpful advices ...[thumbsup2]

PS : do you know how to build an HTML App ? I don't know anything about it but it seems quite cool ...

See you ! [wink]
Floof
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top