[thelist] One popup window, different sizes

Robert Vreeland vreeland at studioframework.com
Thu Oct 13 08:00:35 CDT 2005


As I thought over more this morning, it occurred to me that the example I
wrote would fail if the user closed the window; since popWin would no longer
= "" and not be pointing to an open window. So I would change the test to:

if(window.popWin.location)
{
	//window exists
}
else
{
	//window doesn't exist
}

Additionally, it may be that Safari on the Mac wants you to specifically
name the window in the open method to maintain a usable pointer. I revised
my earlier code below to reflect this.

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Robert Vreeland
Sent: Wednesday, October 12, 2005 10:25 PM
To: thelist at lists.evolt.org
Subject: RE: [thelist] One popup window, different sizes

Try this (not tested)
----- In the javascript section -----
popWin = "";
Function loadWindow(newTarget, newWidth, newHeight) {
	//test to see if window exists	
	if(window.popWin.location)
	{
	//it does
		popWin.location = newTarget;
		popWin.resizeTo(newWidth, newHeight);
	}
	else
	{
	// doesn't exist yet
		popWin = window.open(newTarget,"popWin","height=" +
newHeight + ", width=" + newWidth + ",location=0,menubar=
0,resizable=1,scrollbars=0,status=0,toolbar=0");
	}
	
}

------Links in opener window------
<a href="javascript: void(null)" 
onclick="loadWindow('experience2.html','340','380');">Experience</a>
<a href="javascript: void(null)" 
onclick="loadWindow('origins3.html','670','485');">Origins</a>
<a href="javascript: void(null)"
onclick="loadWindow('cinema.html','315','420');">Cinema</a>

Hope it helps,
Robert Vreeland

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Robert Carpenter
Sent: Wednesday, October 12, 2005 6:53 PM
To: thelist at lists.evolt.org
Subject: [thelist] One popup window, different sizes

Hi all-

I have some flash content (3 different swf's) that I'd like to display in
popup windows. Ideally, I'd like reuse the same window as the user clicks
the various links in the main opener window, but the swf's are dramatically
different in size, so I'd like the window to fit tightly to the content as
each new swf is loaded.

Alternatively, I'd be happy to close the current popup window and reopen it
with the dimensions of the new swf, and I've worked out a script that seems
to work dandy in IE/win and Firefox, but is failing miserably in Safari with
the error "Value undefined (result of expression popWin.close) is not
object."

I have a suspicion I'm not the first person to want to do this, does anybody
have a suggestion to improve this script, or any alternative approach?

Thanks in advance!
-Robert-

----Script------

function popNew(a,n,h,w)    {
if((typeof(popWin) != "undefined")){
    popWin.close();
    }
popWin = window.open(a,n,'directories=0,height=' + h + ',width=' + w +
',location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0');
return false;
}
----------------

------Links in opener window------
<a href="_swf/experience.html" target="exp"
onclick="popNew('experience2.html','exp','340','380');">Experience</a>
<a href="_swf/origins.html" target="exp"
onclick="popNew('origins3.html','exp','670','485');">Origins</a>
<a href="cinema.html" target="exp"
onclick="popNew('cinema.html','exp','315','420');">Cinema</a>
--------------------------------



-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives
of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 

-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives
of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 



More information about the thelist mailing list