Background
- I have a search engine that is developed in php that i'm taking a wack at modifying.
- Every page on the site contains an iframe. The user can use this iframe to search for and display search result listings.
- I've read about the sins of iframes but I have a strategy that I think is appropriate, however, I'm open to others that better serve an SEO strategy.
Functionality I'm seeking
When the user clicks on a listing displayed in the search results within the iframe, it will load the linked content as the parent page, which also contains an iframe. When the new page loads, I want to maintain the search results in the iframe from the previous page.
My train of thought for a solution
Capture the URL of the iframe before loading a new parent page by saving it as a session, then, call the saved session information as the src attribute for the new iframe being loaded in the parent window.
FYI - The reason I want to capture the iframe's URL is because the search results displayed in the iframe are defined by parameters in the iframe's URL.
2 things I need help with
1. How do you save the current iframe's URL in a session.
I got the following to work in the iframe...
Code: Select all
echo "<input name=page type=hidden value=searchfile.php?" . $_SERVER['QUERY_STRING'] . ">";Code: Select all
session_start();
$_SERVER['QUERY_STRING'] 2. How do I call the session information into the "src" attribute of the iframe of the new page that is loaded. I'm thinking javascript but I'm curious if their is a better solution using php without taxing the server.