Ajax software
Free javascripts
↑
Main Page
You should at least provide a link back to the home page, and ideally to some more relevant parent
page. Otherwise, the user may be completely lost and will proceed to the nearest back button.
It is not always desirable to have a popup spidered by a search engine. Between the navigational con-
cerns, and the fact that popups very often do not contain substantial information, it may be wiser not
to. Unless the popup has substantial information, we advise excluding the popups from the spiders’
view entirely.
You can obtain the page from which the user navigated to the popup by reading the
$_SERVER[‘HTTP_
REFERER’]
header value. This information allows you to show navigational elements only if the user
has arrived from an external web site, such as a SERP.
This method is not 100% reliable, because some firewall applications block the REFERER information.
Also, if the referring page is secured via HTTPS, the REFERER information won’t be available. In this
exercise, when there is no REFERER data, err on the safe side and display the navigational elements.
You can try out this technique by going through a short exercise.
Implementing Spiderable Popups
1.
Add a link to your popup file in your
catalog.php
script, as highlighted in the following code
snippet. Note that this assumes you’re working on the code that you built in the previous chap-
ters. If you don’t have it ready, feel free to use the code download of this chapter.
<?php
// load the URL factory library
require_once ‘include/url_factory.inc.php’;
?>
...
...
...
<li>
<a href=”<?php echo make_category_product_url(“Friends’ Shed”, 2, “PHP
E-Commerce Book”, 42); ?>”>
Friends’ Shed: PHP E-Commerce Book
</a>
</li>
</ul>
<center>
<a href=”popup.php” target=”_blank”>Find more about Professional Search
Engine Optimization with PHP!</a>
</center>
</body>
</html>
2.
Load
http://seophp.example.com/catalog.html
to ensure your script loads correctly and
displays the new link, as shown in Figure 6-1. Note that this exercise assumes you have built
your simple catalog as shown in Chapter 3.
123
Chapter 6: SE-Friendly HTML and JavaScript
c06.qxd:c06 10:55 123
Ajax software
Free javascripts
→