Page 1 of 1

popup window

Posted: Sun Feb 20, 2005 3:08 pm
by bmac11
Why doesn't this work? The link works. It just doesnt open in a popup window.

Code: Select all

$link_popup = "<a href='x.php' onclick='window.open('x.php','popup','width=500,height=400,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false'>Test Popup</a><BR>";

echo $link_popup . "<BR>";

I when I use it only in html, it works, but I would like to pass a php variable to the new window too.

Code: Select all

?>
<a href="x.php" onclick='window.open('x.php','popup','width=500,height=400,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false'>Test Popup</a>
<?php
How can I get either one to work?
thanks!

Posted: Sun Feb 20, 2005 3:10 pm
by feyd
technically, neither works.

Code: Select all

$link_popup = '<a href="x.php" onclick="window.open(\'x.php\',\'popup\',\'width=500,height=400,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0\'); return false">Test Popup</a><BR>';

echo $link_popup . '<br />';

Posted: Sun Feb 20, 2005 3:15 pm
by bmac11
Is there a way I can pass a php variable to a popup window? If so, please point me in the right direction on how to go about creating one.

Posted: Sun Feb 20, 2005 3:18 pm
by feyd
you can pass it via sessions, or through the url you use to create the popup. Just be aware that most people have popup blockers now, and are likely to not turn them off.

Posted: Sun Feb 20, 2005 3:28 pm
by jonemo
keep in mind, that most popupblockers don't block popups that open by user actions like a click. they just keep popups that happen without any user action.

Posted: Sun Feb 20, 2005 4:14 pm
by bmac11
I'm still a little confused. If I use

Code: Select all

$link_popup = "<a href='x.php' onclick='window.open('x.php','popup','width=500,height=400,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false'>Test Popup</a>";

echo $link_popup . "<BR>";
it doesnt open the new popup window. It only opens it in current window.

But if I do it without php (only in html), it works, but then I can't pass a php variable to it.

Posted: Fri Mar 11, 2005 8:39 am
by rjwebgraphix
feyd wrote:Just be aware that most people have popup blockers now, and are likely to not turn them off.
There is code somewhere, somehow to bypass popup blockers. Using the standard OnClick will not work. I find many popup blockers will block any of the standard methods.

I have seen sites that do a popup for a contact form that the popup blocker does not block.

I was hoping by searching through messages that I could find something that would work, but unfortunantly it doesn't look like it.

Sites do have legitimate reasons for not loading a whole new page just for a small contact form, which is my usage, but don't want the popup blocked by popup blockers, just like I've seen on other sites.

I'm assuming this must be done server side some kind of way, but I may be wrong as it should normally be the client side that executes a popup window.

Any ideas how you can popup a window and not have a popup blocker block that popup??????

Any help would be appreciated.

Posted: Fri Mar 11, 2005 8:46 am
by feyd
you can use a visibility trick, where you "pop" a pane containing the information. It's contained in the page, and typically will not be blocked by a blocker.. Some browsers will only block a popup until you request the popup by clicking on something that'd normally generate one. However IE does not support such an action at this time (that I remember anyway)