Page should redirect if not opened in iframe lightwindow


I’m quite new at JS and I just started messing about with jQuery a bit.
I was wondering if you guys could help me…

I am using Jquery Superbox to open a page in an iframe in a lightwindow.
My problem is that Google will index and link to them individually. If people land on them they don’t get the menu and stuff…
But they should redirect to my original page if you land on them. And there open the lightwindow and then load the requested page in the iframe.

I allready found a script here that will redirect the pages and display them (if there would be an iframe in my page from the start). But I don’t know how I can open the lightwindow first and then open the page in the iframe.

I’ll attach a zip with an example page of my code so you have something to mess around with… It’s just this code, nothing else…

apparently the zip needs approval, so you can also find it here on rapidshare: (5KB)

Is that some kind of multi-page redirect technique that you’re using?

What do you mean exactly? I have one main page. My content (seperate pages) load in an iframe in a modal box.

But these contentpages will show up individually in Google. This is not aproblem, but they should only be showed when in a modal box on my main page.

So I need:

  1. a redirect to the main page
  2. open a modal box with an iFrame
  3. open the specific page in that iFrame.
  1. You can use location.href to redirect to a different location.

  2. I don’t know much about modal boxes in native javascript, however, jQuery Dialog boxes support modal behaviour very well.
    Otherwise, you might just want to use an iframe element within the HTML code of the main page.

  3. To open a page in the iframe, you would first gain a reference to the iframe, then change its href property to the page you came from. You can use document.referrer to get that previous page.

I have set up a modal box in jquery and a redirect in javascript. See the attached file above.

My current script can open a modal box from a link in the main page. No prob.
And it can also redirect from the detailpage to the mainpage if it’s not loaded in an iframe. And then send the page url to an iframe to show it. No prob.

Problem is… There is no iframe on the mainpage. Only in the modal box.

I just need a way to first open the modal box and then display the page in the iframe of that modal box.