Re: CLOSE button or <a href""> link
| From: | Neil Smith [MVP, Digital media] | Date: | Thu, 22 Dec 2005 15:55:20 +0000 |
| Subject: | Re: CLOSE button or <a href""> link | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-40891@lists.php.net to get a copy of this message | ||
At 07:18 22/12/2005, you wrote:
From: "Ron Piggott (PHP)" <ron.php@actsministries.org> Reply-To: ron.php@actsministries.org To: PHP DB <php-db@lists.php.net> Content-Type: text/plain Date: Thu, 22 Dec 2005 02:22:00 -0500 Message-Id: <1135236120.4014.20.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: CLOSE button or <a href""> link What I really want to have happen is for the CLOSE WINDOW button to appear when this is loaded as a pop up window from our online_offering_basket.html file and if the web page is loaded directly then the link to our Online Offering Basket appear for the user to get back into our web site. Do you know how to do this?Yes, and this is a client side javascript problem unless you create the popup page using a PHP script. AFAIK from your file paths, it's HTML so PHP (and indeed, DB "databases", the subject of this discussion group) don't apply here. You need to run a short snippet of javascript to determine if there's a "window.opener" object : That will point back (and have a .location.href property) of the opening page. I'd check for <script language="javascript1.2" type="text/javascript"> if (window.opener != null) {
// (Probably) sent here from the online_offering_basket.html page
// Check that though to prevent spoofing :
if (window.opener.location.href.indexOf('online_offering_basket.html' != -1) {
document.write('<a href="#" onclick="self.close()">Close Window</a>');
} else {
document.write('<a href="http://www.actsministrieschristianevangelism.org">Back To Site</a>');
}
} else {
// Linked directly from the how_we_operate_our_benevolent_fund.html page
document.write('<a href="http://www.actsministrieschristianevangelism.org">Back To Site</a>');
}
</script>