views:

344

answers:

1

I have an asp.net site using the Google Mini. I have a search box on the masterpage that redirects to a search results page that displays the results in an iFrame. This approach is all taken from the documentation provided by Google for the Mini and seems pretty simple.

What the doc doesn't cover (or I can't find) is that clicking on any of the result that might be another .aspx page, opens that page with all of it's masterpage glory right inside the iFrame which is obviously not desired. I end up with a page in a page.

Short of grabbing the xml search results and manipulating that myself, how do I just get the search result links to open like a normal page?

A: 

You can add this javascript into your masterpage to make it break out of the iframe when the user clicks the link

<script type="text/javascript">
try
{
    if (self.parent.frames.length != 0)
    self.parent.location=document.location;
}
catch (Exception) {}
</script>

Another way of doing this would be to use the target attribute of the anchor (<a>) tag. If I remember correctly that would be

<a href="whereever" target="_parent">Link</a>

I've used the javascript solution myself before and it works, I've not tested the target.

Kirschstein