PDA

View Full Version : Open Window in Full Mode



Cheng
03-15-2006, 06:15 PM
Hi Everybody.

I want that if I open a link from inside an SWF file created with Swishmak that this page changes to another URL.
But I want that when the page changes to the other URL that it resizes to full window mode.
Can I use this code here below placed in the HTML file that I want to open?
If not could someone please send me the right code for that.

Thanks in advance.
Cheng

<script language="JavaScript1.2">
<!--

/***********************************************
* Auto Maximize Window Script- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for this script and 100's more.
***********************************************/

top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
//-->
</script>

jscheuer1
03-15-2006, 07:16 PM
You can use that but, many browsers will not allow it, depending upon their settings. Most however will. The only way to get a higher degree of compliance among browsers is to also use the window.open() method from your flash file if that is allowed:


window.open('thepage.html','','top=0, left=0, width='+screen.availWidth+', height='+screen.availHeight)

Cheng
03-17-2006, 02:51 AM
Hi John.

Thanks for your reply.
I entered this script only in Swishmax and it worked, but it opened a new window.
What I wanted was that the window that is already open changes to the new URL and then expands full window mode.
Is this possible as well?
Or maybe that when the new window opens, the one with the link to it closes automaticly would be ok, too.

Thanks again.

I appreciated.
Cheng

jscheuer1
03-17-2006, 04:14 AM
Sorry, you can name the window with the flash on it and use that name with the window.open() method. That will launch the new page in the same window but window position and size can no longer be set by the window.open() method in that situation. What happens is that the existing window's size and position are inherited.

On the other hand, you could close the existing window but, only if it had itself been opened using window.open(). This didn't use to be the case but, with phishing and other abuses of that nature, browsers will no longer allow a situation where the original window is closed via javascript. There must always be a window open that was arrived at via an ordinary link so that the user cannot be trapped in a pseudo site. You could always ask the user to close the first window him or herself.

Alternatively, you could simply rely upon the original script you mentioned at the beginning of this thread. It will work in IE6, the most widely used browser. For those browsers that may not allow it (only some and then only if so configured), you could display instructions to maximise the window, like "best viewed full screen":


<script type="text/javascript">
if ((top.window.outerWidth&&top.window.outerWidth<screen.availWidth)||(top.window.outerHeight&&top.window.outerHeight<screen.availHeight))
document.write('Best viewed full screen')
</script>

The above could go in the body of the new page with the original script you have being in the head. If the script in the head fails and the user doesn't happen to be surfing fullscreen, then and only then will they see the message.

Cheng
03-18-2006, 12:27 PM
Hi John.

Thanks a lot.
I'll give it a try and let you know the outcome.

Thanks again.
Cheng