-
Hi all, maybe someone here can help with this?
I would like a script, that is page dependant, in that where ever a person comes to view the page, it will resize to the desired sizes and no tool bar, menu bar etc.
For example: somebody submits a search query, and the template will have the code, to resize the window, or a confiramtion page holds the script, so it will be displayed in a small window.
I have found and used this following script:
<!-- full screen
if (top.frames.length!=0)
top.location=self.document.location;
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
//-->
No matter where someone comes from, (search engine etc) this script will run, and open the window to full size :) I would like a similar script that will open the window to a specified size, and without tool bar, menu bar etc.
With out being able to write my own scripts I can only rely on the expertise of others, and just edit to suit my own requirments.
Thanks in advance to anyone that can help :)
-
Tex...have you tried:
<!-- full screen
if (top.frames.length!=0)
top.location=self.document.location;
self.moveTo(0,0)
self.resizeTo(800,600)
//-->
Although regardless if that works or not I would recommend against doing what you are trying for.
I personally HATE when a site tries to take over my screen, and I will typically close it without even looking at the information contained in it.
-
Nice one creole, unfortunatly that doesn't work :(
I understand what you're saying about the popup window being annoying and I do agree :) but the way I intend to use it will be creativly and not abusive or obstructive :)
Please help :D
-
TexDread...try this one
<script language="JavaScript">
<!--
function openWindow(page,name) {
popupWin = window.open('status,scrollbars,width=250,height=350,left=550,top=50')
}
// -->
Then you could call this function with the body tag
<body onload="openWindow(yourpage.html,NameOfWindow">
That would open a new window when that page was loaded, you could also toy with an additional script that would close the referring window with something like onBlur="window.close"
-
Nope :( This opens a new window to that size etc, and it really needs to resize its self onload.
Did you try the script I posted?
Thanks...
-
Tez....I just tried the script you listed, with the change I made using this code and it worked for me in IE 5 for the Mac
<html>
<head>
<title>Untitled</title>
<script type="javascript">
<!-- full screen
if (top.frames.length!=0)
top.location=self.document.location;
self.moveTo(0,0)
self.resizeTo(800,600)
//-->
</script>
</head>
<body>
</body>
</html>
That code resized the window to 800,600 and pusehd the window up to the Top corner of the screen.
-
You're absolutly right :) I don't know what I was doing wrong? Some baody also informed me that I could also use
<script>
window.resizeTo(800,600)
</script>
This will be better as it's shorter
All are saying that there is no way of disabling the menu bar etc without it being a popup window, darn it :)
"I Often Want The Imposible"
Thanks again for your help, I wouldn't get far without the help of people and these forums :)
-
BULLSEYE!!!
TexDread...this is the script that you are looking for. It tests out in IE 5 and NS 4.7 for the Mac (so I would assume that it would work for Windows)
This page will open a new window (user specified) and then close the first window behind it.
<html>
<head>
<title>Untitled</title>
<script language="javascript">
function popLink(Link){
popup = window.open(Link,"newwin","height=200,width=300,scrollbars=no")
}
var timer = null
function closeMe() {
self.close()
}
//-->
</script>
</head>
<body onLoad="javascript:onClick=(popLink('loadme.html')), timer=setTimeout('closeMe()',0000)"">
</body>
</html>
It took me a little time to play with it, but I finally got it.
-
:) That's top! certainly gets around it, and with that window resize in the first window it works well.
I am slowly getting to know a little javascript but not without the help people like you, it's all good :)
Thanks again for your help creole....!
-
-
Creole, in IE anyway, that script will throw an annoying "This window is trying to close itself" box, if I read it right...?
-
etLux...when I assembled it, I thought that would happen too, but it does not. Don't know WHY it doesn't but it doesn't and so that is good enough for me.
<added>
etLux...I think the reason why it does not get an error is that I am using self.close instead of window.close. I could be wrong, but that seems to make sense to me.
</added>
<Edited by creole on 11-29-2000 at 10:35 AM>
-
tis true, I also got the box about closing window with IE 5.5, wasn't to bothered though.
-
weird...it must be a
Mac thing then. I never got the box about the window closing.
-
Hey Creole.
Just for the record... I tried the exact code (and a few variations) in IE on Windows. It always throws the alert.
I've tried to get around this before, and never had any success in it. IE/Win appears to think it's a good idea to holler at you in this scenario -- and I can't say I entirely disagree.
Say, for instance, you open a fullscreen mode window with no means of closing it, whilst closing the launch (parent) window; and the user is unaware that it can be closed with Alt-F4.
-
The 'annoying dialog' about the script trying to close the window will always come up in certain versions of IE when other pages have been browsed to other than the window's opener. If you tried opening a separate window with a "Close this window" button, you would have no problems.
-
"Child" windows (popups) *never* show the alert -- it's just when you try to call the "parent" to close that you'll get it.
Not sure on how this works on Mac's -- haven't had a chance to check it -- but in Windows, it appears you always get this.