Page 1 of 1

How do you resize the new window you're opening?

Posted: Sun May 16, 2010 10:19 pm
by Beefhead
Hey guys

I've been trying to figure out the php code- or javascript/html, to resize the browser window once they click on my banner- which is an LP.

I have an image on a page that when the visitor clicks on it and gets transferred to the new page- I want the browser window to resize.

Any thoughts..?

I still need to maintain the target passthrough which is part of my problem.. so I need to integrate

Code: Select all

<BODY>
<?php  $passthrough = $_GET['target_passthrough'];

?>
  <a href="http://track.com/tracking202/redirect/dl.php?t202id=#&$#*&t202kw=<? echo $passthrough; ?>"><IMG SRC="http://url.com/images/sugar.jpg" border=0></a>

with..

<script>
<!--
function wopen(url, name, w, h)
{
 var win = window.open(url,
  name);
 win.resizeTo(w, h);
 win.focus();
}
// -->
</script> 
Cheers!

Re: How do you resize the new window you're opening?

Posted: Sun May 16, 2010 11:13 pm
by Beefhead
I tried running this code but it only makes a little button. I want the whole banner/image/lp to be clickable to a larger browser window when it transfers to next page.

Thanks

Re: How do you resize the new window you're opening?

Posted: Mon May 17, 2010 2:55 am
by Benjamin
:arrow: Moved to Javascript

Re: How do you resize the new window you're opening?

Posted: Mon May 17, 2010 10:09 am
by pickle
When you create a new window, you can assign it to a variable:

Code: Select all

var myWin = window.open('window opening parameters go here');
You can then call resize() on that `myWin` variable.

Re: How do you resize the new window you're opening?

Posted: Mon May 17, 2010 2:31 pm
by kaszu

Code: Select all

var myWin = window.open(url, name, 'width=' + w + ',height=' + h);

Re: How do you resize the new window you're opening?

Posted: Mon May 17, 2010 6:11 pm
by Beefhead
Inside a javascript tag or php tag?

Apparently window resizing is DOM which is javascript not php. However myWin looks like PHP..

Re: How do you resize the new window you're opening?

Posted: Mon May 17, 2010 6:19 pm
by Beefhead
Looks right.. but not working lol :drunk:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>
<?php  $passthrough = $_GET['target_passthrough'];

?>

<script language="JavaScript">

var myWin = window.open('http://track.com/tracking202/redirect/dl.php?t202id=7697&t202kw=', Sugar!, 'width=1200' +  w + ',height=1200' + h);

</script>

  <a href="http://track.com/tracking202/redirect/dl.php?t202id=7697&t202kw=<? echo $passthrough; ?>"><IMG SRC="http://url.com/images/sugar.jpg" border=0></a>


 </BODY>
</HTML>

Re: How do you resize the new window you're opening?

Posted: Mon May 17, 2010 6:43 pm
by Benjamin
When you post HTML in the forum, please highlight the code, click the PHP Code button, and then change

Code: Select all

 to [syntax=html].

Thank you.

Re: How do you resize the new window you're opening?

Posted: Mon May 17, 2010 9:47 pm
by Beefhead
Got it! Looks like this..

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>
<?php  $passthrough = $_GET['target_passthrough'];

?>

<script language="JavaScript">

function resize()
{

self.resizeTo(width=1200, height=1200);
window.location.href = "http://track.com/tracking202/redirect/dl.php?t202id=7697&t202kw=<? echo $passthrough; ?>";

}

</script>

 <a href="javascript:resize();"http://track.com/tracking202/redirect/dl.php?t202id=7xb7&t202kw=<? echo $passthrough; ?>"><IMG SRC="http://sugar.com/images/sugar.jpg" border=0></a>


 </BODY>
</HTML>
Sure Ben didn't realize. Cheers